Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to retrieve the security descriptor of a Win32 Service. For that, I'm doing, in PowerShell,

$sd = (Get-WmiObject -class Win32_Service | ?{$_.Name -like "dummyservice"}).GetSecurityDescriptor()

Thing is, $sd.Descriptor is $null, and $sd.ReturnValue is 0x80070522, which translates to "a required privilege is not held by the client"

I'm running all this in an admin session in a admin PS prompt. I tried both on Win 7 and Win 2008, same result.

Any idea what I'm doing wrong? Thanks in advance.

(Some context: I need to retrieve a security descriptor of a service to add some rights for a user to be able to start that service, then reassign that security descriptor back.)

share|improve this question

try this

((Get-WmiObject -class Win32_Service | ?{$_.Name -like "dummyservice"})).GetSecurityDescriptor()

share|improve this answer
why would that be different than my original expression?? – Ariel Jul 2 '10 at 12:45
when I run your code I get the same error when I run my code no error. In other words you got your objects screwed up. – tony roth Jul 8 '10 at 18:43
@ariel can you remove the down vote please. – tony roth Jul 9 '10 at 17:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.