How-to: Retrieve Computer Information

List Computer properties as displayed in ADUC

'compinfo.vbs

' Usage:
'        cscript //Nologo compinfo.vbs

' List Computer properties as displayed in ADUC

On Error Resume Next
Dim objSysInfo, objComp
Set objSysInfo = CreateObject("ADSystemInfo")

' Current computer
Set objComp = GetObject("LDAP://" & objSysInfo.ComputerName)
 ' or a specific computer:
 ' Set objComp = GetObject("LDAP://CN=pc005,OU=Computers,DC=ss64,DC=com")

WScript.Echo "--- Computer Properties ---"
WScript.Echo "Name: " & objComp.name
WScript.Echo "cn: " & objComp.cn
WScript.Echo "DNSHostName: " & objComp.dNSHostName

WScript.Echo "OperatingSystem: " & objComp.operatingSystem
WScript.Echo "ServicePack: " & objComp.operatingSystemServicePack

WScript.Echo "SAMAccountName: " & objComp.sAMAccountName
WScript.Echo "Location: " & objComp.location
WScript.Echo "UserAccountControl: " & objComp.userAccountControl
WScript.Echo "PrimaryGroupID: " & objComp.primaryGroupID
WScript.Echo "WhenCreated: " & objComp.whenCreated
WScript.Echo "WhenChanged: " & objComp.whenChanged
WScript.Echo "DistinguishedName: " & objComp.distinguishedName

“Success is falling nine times and getting up ten” ~ Jon Bon Jovi

Related VBScript commands

userinfo.vbs - List properties of a User (as shown in ADUC).
Active Directory / LDAP User Attributes.
ListComputers.vbs - VBScript to list all computers.
SearchAD - Search AD for either Users, Computers or groups.
Equivalent PowerShell: Get-adComputer "Computer64" -Properties *


 
Copyright © 1999-2024 SS64.com
Some rights reserved