Getting error when trying to retrieve a security Descriptor from a Win32_Service class

0

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.)

windows
security
powershell
asked on Server Fault Jun 30, 2010 by Ariel

1 Answer

-1

try this

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

answered on Server Fault Jun 30, 2010 by tony roth

User contributions licensed under CC BY-SA 3.0