Код:
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objWMIService = GetObject( "winmgmts:\\.\root\cimv2" )
Set colItems = objWMIService.ExecQuery( "Select * from Win32_ComputerSystem" )
For Each objItem in colItems
strUserName = objItem.UserName
'WScript.Echo "User Name: " & strUserName
Next
i_1 = len(strUserName)
i_2 = InStr(1,strUserName,"\",vbTextCompare)
i_3 = i_1 - i_2
strUserName = Right(strUserName, i_3)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objAccount = objWMIService.Get("Win32_UserAccount.Name='" & strUsername & "',Domain='" & strComputer & "'")
getSID = objAccount.SID
MsgBox getSID