Determine the ADsPath for the Logged-On User
#-----------------------
#Save the following as adspath.vb
#-----------------------
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
Wscript.Echo objUser.AdsPath
#----------------------
#Done
#----------------------
this is an incredibly useful object, one that can return all sorts of information about the logged-on user and the local computer.
The one drawback to this object is the fact that it can only be created locally: you can’t create an instance of ADSystemInfo on a remote computer and then get information about the user logged on to that machine.
沒有留言:
發佈留言