Home > Blockchain >  Registry Powershell Scripting
Registry Powershell Scripting

Time:12-09

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?

  • CategoryInfo : NotSpecified: (ERROR: Invalid syntax.:String) [], RemoteException
  • FullyQualifiedErrorId : NativeCommandErro

CodePudding user response:

Any key with spaces needs quotes. A backslash at the end of a key would be a problem in 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.

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