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.)
try this
((Get-WmiObject -class Win32_Service | ?{$_.Name -like "dummyservice"})).GetSecurityDescriptor()
User contributions licensed under CC BY-SA 3.0