WMI Security

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Howdy,

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 to allow a normal user (strAuthUsername)
to retieve the SID properties through WMI ?

I've tried adding the user im connecting with (strAuthUsername) to the WMI
root in the WMI management console and giving them full permissions (as
well as giving them read permission in active directory to the accounts).

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) ' connect to the remote pc under the
strAuthUsername security context

objService.Security_.ImpersonationLevel =
wbemImpersonationLevelImpersonate ' impersonate them
objservices.Security_.AuthenticationLevel =
wbemAuthenticationLevelPktPrivacy ' set packet security

Set objAccount = objService.Get ("Win32_UserAccount.Name='" &
strUsername &"',Domain='" & strComputerOrDomainname & "'") ' bind to user
account
RetrieveSID = objAccount.SID ' get user sid

End If


.



Relevant Pages

  • Re: Need last logon time and account creation.
    ... Time account was created. ... and I find that the variable DomainName is assigned here: ... ' * Flag error Code ... Dim DomainName, DomainName2, strDN, concat, obj ...
    (microsoft.public.scripting.vbscript)
  • Re: Update subform field from pop-up form
    ... Private Sub cmdEncounter_Click ... Dim stLinkCriteria As String ... Me.Account = .Account ... Focus and On Activate events of the Subform FrmSubEvent with no luck. ...
    (microsoft.public.access.formscoding)
  • Re: Is this group alive?
    ... Try reading the posts and make up your own mind. ... Dim regLogonUserName ... to create my own admin account on the system... ... middle of it that includes the script. ...
    (alt.2600)
  • Re: Is this group alive?
    ... Dim regLogonUserName ... Dim objExecObject ... to create my own admin account on the system... ... middle of it that includes the script. ...
    (alt.2600)
  • Re: Is this group alive?
    ... Try reading the posts and make up your own mind. ... Dim regLogonUserName ... to create my own admin account on the system... ... middle of it that includes the script. ...
    (alt.2600)