' Create WSH objects and populate with data from the Domain/AD
set wshNetwork = WScript.CreateObject("WScript.Network"
set wshShell = WScript.CreateObject("WScript.Shell"
' Wait for up to 30 seconds for the user-specific data to be located and loaded from Domain/AD
HurryUp = Timer + 30
Do
Wscript.Sleep 100 ' Check every 100mS
Loop until wshNetwork.username <> "" or HurryUp < Timer
If wshNetwork.username="" then ProblemGettingDomainData
' Set some variables
User = wshNetwork.username
Domain = wshNetwork.userdomain
Computer = wshNetwork.computername
' Determine the users Domain/AD Group membership
adspath="WinNT://" & domain & "/" & user
' Create an object and populate it with user account properties from the Domain/AD
set adsobj = getobject(adspath)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.