On Error Resume NextstrComputer = "."
Set objWMILocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMICimService = objWMILocator.ConnectServer(strComputer, "root\cimv2")
Set colOS = objWMICimService.ExecQuery("Select * from WIN32_UserAccount where Name=""DesiredUsername""")
for each obj in colOS
WScript.Echo "Name: " & obj.Name & " /SID: " & obj.SID & ""
'created by Julian Ruf
Windows Scripting BLOG
Due to limited time working on this project this place is not intended to people who are new to scripting but much more for people who are already familiar with the VBS/WMI syntax.