Check Workstation Status in AD

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

Set colComputers = objWMIService.ExecQuery _
(“Select DomainRole from Win32_ComputerSystem”)

For Each objComputer in colComputers
Select Case objComputer.DomainRole
Case 0
strComputerRole = “Standalone Workstation”
Wscript.Echo “This is NOT on the domain. Reload [HTA]”
Case 1
strComputerRole = “Member Workstation”
Wscript.Echo “This is on the domain. Exit [HTA]”
End Select
Next

email me