Can I create a generalized vm image with RDP disabled

86 views Asked by At

How can we create windows VM image with RDP disabled for VMs created from that image? I want publish an RDP hardened image.

1

There are 1 answers

1
Markus Meyer On BEST ANSWER

You can do this with a Custom Script Extension for Windows

Create a PowerShell scripts which disables RDP and reference it:

{
  "fileUris": ["https://mystorage.blob.core.windows.net/privatecontainer/script1.ps1"],
  "commandToExecute": "powershell.exe script1.ps1",
  "managedIdentity" : {}
}

Powershell script to disable RDP in registry:

Invoke-Command –Computername "customname" –ScriptBlock {Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" –Value 1}