A
Angelo Campitelli
Im running running the follwing code to connect to one of my domain
controllers and retrieve the SID for a user account. The works fine with the
domain administrator account but not for a normal user..
What permissions fo i need to set?
Ive tried adding the user im connecting with (strAuthUsername) to the WMI
root in the WMI management console and giving them full permissions.
Is their somewhere else i need to set permissions to allow remote
connections by non admin users?
RetrieveSID (strComputer, strUsername,
strComputerOrDomainname,strAuthUsername,strAuthPassword)
Dim objWMIService
Dim objAccount
Dim mySID
Dim objLocator
Dim objService
RetrieveSID = -1
On Error Resume Next
wbemImpersonationLevelImpersonate = 3
wbemAuthenticationLevelPktPrivacy = 6
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer (strComputer, "root\cimv2",
strAuthUsername, strAuthPassword)
objService.Security_.ImpersonationLevel =
wbemImpersonationLevelImpersonate
objservices.Security_.AuthenticationLevel =
wbemAuthenticationLevelPktPrivacy
Set objAccount = objService.Get ("Win32_UserAccount.Name='" &
strUsername &"',Domain='" & strComputerOrDomainname & "'")
RetrieveSID = objAccount.SID
End If
controllers and retrieve the SID for a user account. The works fine with the
domain administrator account but not for a normal user..
What permissions fo i need to set?
Ive tried adding the user im connecting with (strAuthUsername) to the WMI
root in the WMI management console and giving them full permissions.
Is their somewhere else i need to set permissions to allow remote
connections by non admin users?
RetrieveSID (strComputer, strUsername,
strComputerOrDomainname,strAuthUsername,strAuthPassword)
Dim objWMIService
Dim objAccount
Dim mySID
Dim objLocator
Dim objService
RetrieveSID = -1
On Error Resume Next
wbemImpersonationLevelImpersonate = 3
wbemAuthenticationLevelPktPrivacy = 6
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer (strComputer, "root\cimv2",
strAuthUsername, strAuthPassword)
objService.Security_.ImpersonationLevel =
wbemImpersonationLevelImpersonate
objservices.Security_.AuthenticationLevel =
wbemAuthenticationLevelPktPrivacy
Set objAccount = objService.Get ("Win32_UserAccount.Name='" &
strUsername &"',Domain='" & strComputerOrDomainname & "'")
RetrieveSID = objAccount.SID
End If