Registry Modify Query

If I run regedit elevated I can manually change values on the below key:(DeviceState)

If I try an elevated Powershell ISE Session locally at that Regi location :Set-ItemProperty -Path . -Name DeviceState -Value 1

I get

Set-ItemProperty : Requested registry access is not allowed.
At line:1 char:1

  • Set-ItemProperty -Path . -Name DeviceState -Value 1
  •   + CategoryInfo          : PermissionDenied: (HKEY_LOCAL_MACH...e-bcd9b24ad4f7}:String) [Set-ItemProperty], SecurityException
      + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Is my issue here the ‘under the hood’ mechanics of how set-itemproperty is accessing the registry provider?

Probably. The ISE is honestly not a valid “test” environment; what’s it do in the PowerShell console?


Same result

Interesting. I’d have to really dig into the ACLs and stuff, but it does seem like it’s going through a different underlying set of APIs that somehow aren’t working.