hayabusaukuk
IS-IT--Management
Straight-forward question, how can i find a users GUID? on a Win 2003 TS
Thanks
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
GetSIDFromUser Inputbox("Username you want to find SID for","Get SID from user name")
Function GetSIDFromUser(UserName)
If USerName = "" Then
Exit Function
End IF
Dim DomainName, Result, WMIUser
If InStr(UserName, "\") > 0 Then
DomainName = Mid(UserName, 1, InStr(UserName, "\") - 1)
UserName = Mid(UserName, InStr(UserName, "\") + 1)
Else
DomainName = CreateObject("WScript.Network").UserDomain
End If
On Error Resume Next
Set WMIUser = GetObject("winmgmts:{impersonationlevel=impersonate}!" & "/root/cimv2:Win32_UserAccount.Domain='" & DomainName & "'" & ",Name='" & trim(UserName) & "'")
If Err = 0 Then
Result = WMIUser.SID
Else
Result = ""
End If
On Error GoTo 0
If Result <> "" Then
inputBox "SID for user: " & Username, "User SID", Result
Else
msgbox "Unable to find the requested users SID." & VbCrLF & "Most likely the user does not exist." , 16, "User SID"
End If
Set WMIUser = Nothing
End Function