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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve remote user machine name and domain name

Status
Not open for further replies.

mjjks

Programmer
Jun 22, 2005
138
US
Hi experts.
Here's situation I'm in. In an ASP page on IIS server I need to retrieve user domain name and user machine name and put into a database.

Request.ServerVariables gives me only username and IP address of user's machine.

Based on those two pieces of info (LOGON_USER & REMOTE_HOST), how can I retreive domain name and user's machine name?

Tried couple of WHS scripts but that didn't work.
Any ideas are greatly appreciated.

Thanks
 
Try this and just take out the info you do not need.

ALso here is a good tool...


-----------------------------------------------------------

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_NTDomain")

For Each objItem in colItems
Wscript.Echo "Client Site Name: " & objItem.ClientSiteName
Wscript.Echo "DC Site Name: " & objItem.DcSiteName
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "DNS Forest Name: " & objItem.DnsForestName
Wscript.Echo "Domain Controller Address: " & _
objItem.DomainControllerAddress
Wscript.Echo "Domain Controller Address Type: " & _
objItem.DomainControllerAddressType
Wscript.Echo "Domain Controller Name: " & objItem.DomainControllerName
Wscript.Echo "Domain GUID: " & objItem.DomainGuid
Wscript.Echo "Domain Name: " & objItem.DomainName
Wscript.Echo "DS Directory Service Flag: " & objItem.DSDirectoryServiceFlag
Wscript.Echo "DS DNS Controller Flag: " & objItem.DSDnsControllerFlag
Wscript.Echo "DS DNS Domain Flag: " & objItem.DSDnsDomainFlag
Wscript.Echo "DS DNS Forest Flag: " & objItem.DSDnsForestFlag
Wscript.Echo "DS Global Catalog Flag: " & objItem.DSGlobalCatalogFlag
Wscript.Echo "DS Kerberos Distribution Center Flag: " & _
objItem.DSKerberosDistributionCenterFlag
Wscript.Echo "DS Primary Domain Controller Flag: " & _
objItem.DSPrimaryDomainControllerFlag
Wscript.Echo "DS Time Service Flag: " & objItem.DSTimeServiceFlag
Wscript.Echo "DS Writable Flag: " & objItem.DSWritableFlag
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Primary Owner Contact: " & objItem.PrimaryOwnerContact
Wscript.Echo
Next

Good luck...
 
Thanks RNF0528.

If I use "Select * from Win32_NTDomain", that gives me domain and server info, which I don't need.

I tried "Select * from Win32_NetworkClient", but I guess there's some security issue as it doesn't bring any client info back and I'm not in charge of server/security.

I ended up creating a VB6 DLL that uses windows API to retrieve client info and use it from ASP page. I was able to get LogonInfo, Full UserName, Machine/Node name, Domain Name.

I bookmarked scripting link, thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top