JSI Tip 10039. How can you retrieve Active Directory attributes of the computer you are logged onto, using standard commands?</a>

NOTE: See How can I retrieve Active Directory attributes of the logged on user, using standard commands?

See the following sample:

On Error Resume Next
Dim objSysInfo, objUser
Set objSysInfo = CreateObject("ADSystemInfo")
Set objComp = GetObject("LDAP://" & objSysInfo.ComputerName)
Wscript.Echo objComp.whenCreated
Wscript.Echo objComp.whenChanged
Wscript.Echo objComp.name
Wscript.Echo objComp.userAccountControl
Wscript.Echo objComp.primaryGroupID
Wscript.Echo objComp.sAMAccountName
Wscript.Echo objComp.location
Wscript.Echo objComp.operatingSystem
Wscript.Echo objComp.operatingSystemServicePack
Wscript.Echo objComp.dNSHostName

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.