Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get computer name (or IP address) based on username 1

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
How can I determine either the name of the user's computer or the IP address if all I have is the user's logon name?

Since my application will not be running on the user's machine I can't just user the environ variable. So, I'm attempting to do this via ActiveDirectory (LDAP). I thought there was some way to query LDAP to determine the last time the user logged onto the computer.

(Note I asked this question in the LDAP forum but no hits)
 
Not that I have the foggiest idea but do you mean that they will be running it via Terminal Server and you want the client information?

If that is the case, I'd ask the guys the guys in the Window's forum how they would look it up manually (and of course programmatically). Once you know what you are looking to parallel programatically, try google or post back here but my experience is that obscure questions like this go without real solutions.

Good Luck!
 
Have you added a reference to Active DS Type Library (activeds.tlb) to your VBA project? This will give you a handful of tools for Active Directory, I took a quick look at the object browser and there is a [tt]LoginWorkstations[/tt] property for [tt]IADsUser[/tt] class, or [tt]PrimaryUser[/tt] property of the [tt]IADsComputer[/tt] class that may have the information you are looking for.

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Is the db 'secure'? e.g. users supply SOME sort of id / password to access the db? If so, the logon should be captured (and saved) with each session. If you use MS Access security, then the username is available (UserName? CurrentUser?) and can be used in a variety of ways to trak "who done it".

ONE such tracking procedure is shown in faq181-291, and a search should easily return more hits than you care to review listing a few additional approaches.




MichaelRed


 
CautionMP,

Although I haven't found what I'm looking for yet, activeds.tlb has been an eyeopener. Thanks. So far, the only way I can get what I want is to loop (via WinNT) thru all of the computers defined in ActiveDirectory and see who is logged on to them. This takes way to much time.

MichaelRed, I know what you're saying is true but doesn't apply in my case. For example, I have a table consisting of all of our employees. I want my program to be able to remote in to their machines. However, remote.exe only accepts computer names, IP addresses or Netbios names. All I have is the employee's logon name. So somehow I need to determine the name of the computer (or IP address) the employee is logged onto based on the user's logon name.

Note that SMS allows us to enter the user's logon name to remote. And it only takes a second or 2 to get the computername / ip address. Since SMS is able to do it, we should be able to also.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top