需要启用Turn off Windows+X hotkeys
GPO。我使用了以下查询,但没有启用 GPO。
If (-not (Get-Module GroupPolicy)){Import-Module GroupPolicy}
Set-GPRegistryValue -Name "TestGPO Startup"-Key "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -ValueName NoWinKeys -Value 1 -Type DWORD
我需要为特定用户组启用 GPO。因此我无法使用以下脚本,因为它将禁用所有用户的快捷键。
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name NoWinKeys -PropertyType DWord -Value 1
请帮助我启用Turn off Windows+X hotkeys GPO
答案1
错误说:
Set-GPRegistryValue -Name "Test-GPO" -Key "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -ValueName NoWinKeys -Value 1 -Type DWORD
Set-GPRegistryValue : The following key is not valid for a Group Policy registry setting:
"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer". The key must be in one of
the following registry hives: HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. Make sure that the
Key parameter contains a valid key. Then, run the command again.
因此尝试使用更正的路径:
Set-GPRegistryValue -Name "Test-GPO" -Key "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -ValueName NoWinKeys -Value 1 -Type DWORD