Forum Discussion

Donzera's avatar
Donzera
Copper Contributor
Mar 21, 2023

PowerShell script not updating policies

I am having this problem that I am being stuck for a couple of days now. I have a request to modify policies on Windows 10 21H2, using PowerShell script. To be more specific I am trying to use modify the policy to whitelist USB devices. I am NOT on the step to add the instanceId to the policy.

First thing I need to enable the policy but I am not able to do so.

Policy mention above:

https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.DeviceInstallation::DeviceInstall_Classes_Allow 

I am running the following command:

 

New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\DeviceInstall\Restrictions" -Force | Out-Null
New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DeviceInstall\Restrictions" -Name "AllowDeviceClasses" -Value 1 -Type DWord -Force

 

The first command is creating the path on the registry editor, the second one is adding the value "1" to enable the policy, and the last one updating the policies.

The policy in question is the:

"Allow installation of devices using drivers that match these device setup classes"

 

What I have tried so far, didn't help me. Not even ChatGPT could help me on this one. Hope some of you guys can help me.

No RepliesBe the first to reply

Resources