I have a Powershell script that "builds" a PC from the basic Windows operating system on up (Windows 7 Pro - will be converted to 10 next year). I have a number of reg keys that get added when running this script and they all work fine, no problems.
I am having to add a new reg key which turns off Remote Desktop Services. I can do it at the cmd line with
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
which works fine and dandy. So now I need to add this same key via a Powershell script and I can't get it to work. What I have is
New-Item -Path 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 1 | Out-File $log -append
and when I run that, something pops up that reads
Type:
So I assumed it is asking for a type. But if I add PropertyType as below
New-Item -Path 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -PropertyType DWORD -Value 1 | Out-File $log -append
it gives an error. I've researched at several forums online and nothing seems to work. Any ideas?