PowerShell script not updating policies

Copper Contributor
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:


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.

0 Replies