简体   繁体   English

注册表 Powershell 脚本

[英]Registry Powershell Scripting

When I add the code当我添加代码时

reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\Network Connections\ /f /v NC_ShowSharedAccessUI /t REG_DWORD /d 0

reg add HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\ /f /v /fDisableCdm /t REG_DWORD /d 1

reg add HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\ /f /v /DisablePasswordSaving /t REG_DWORD /d 1

reg add HKLM\Software\Policies\Microsoft\Windows\Kernel DMA Protection /f /v /DeviceEnumerationPolicy /t REG_DWORD /d 0

reg add HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services /f /v /fEncryptRPCTraffic /t REG_DWORD /d 1

reg add HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services /f /v /MinEncryptionLevel /t REG_DWORD /d 3

reg add HKLM\SOFTWARE\Policies\Microsoft\Internet Explorer\Feeds\ /f /v /DisableEnclosureDownload /t REG_DWORD /d 1

reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy\ /f /v /Enabled /t REG_DWORD /d 1

reg add HKLM\SOFTWARE\Policies\Microsoft\PassportForWork\ /f /v /RequireSecurityDevice /t REG_DWORD /d 1

reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR\ /f /v /AllowGameDVR /t REG_DWORD /d 0

A syntax error is returned.返回语法错误。 Does anyone know how to fix this?有谁知道如何解决这一问题?

Any key with spaces needs quotes.任何带空格的键都需要引号。 A backslash at the end of a key would be a problem in cmd.在 cmd 中,键末尾的反斜杠将是一个问题。

reg add "hkcu\my key1" /f /v enabled /d 1 /t reg_dword

You can actually use set-itemproperty in powershell, but it requires that the key already exists.您实际上可以在 powershell 中使用 set-itemproperty,但它要求密钥已经存在。

new-item 'hkcu:\my key1'
set-itemproperty 'hkcu:\my key1' enabled 1 -type dword

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM