fix RDP services: set SessionEnv and UmRdpService start type via registry

sc config fails silently for these services. Use reg add to set
Start=2 (automatic) directly in the registry instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Git Sagar 2026-06-08 09:24:21 +05:30
parent e658cd5404
commit be2fd209e4

View file

@ -97,12 +97,13 @@ in
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LimitBlankPasswordUse /t REG_DWORD /d 0 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LimitBlankPasswordUse /t REG_DWORD /d 0 /f
:: Enable RDP firewall rules and services :: Enable RDP firewall rules for all network profiles
powershell -Command "Enable-NetFirewallRule -DisplayGroup 'Remote Desktop'" powershell -Command "Enable-NetFirewallRule -DisplayGroup 'Remote Desktop'"
powershell -Command "Set-NetFirewallRule -DisplayGroup 'Remote Desktop' -Profile Any" powershell -Command "Set-NetFirewallRule -DisplayGroup 'Remote Desktop' -Profile Any"
sc config SessionEnv start= auto :: Set all RDP services to auto-start via registry (sc config can fail silently)
sc config UmRdpService start= auto reg add "HKLM\SYSTEM\CurrentControlSet\Services\SessionEnv" /v Start /t REG_DWORD /d 2 /f
sc config TermService start= auto reg add "HKLM\SYSTEM\CurrentControlSet\Services\UmRdpService" /v Start /t REG_DWORD /d 2 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\TermService" /v Start /t REG_DWORD /d 2 /f
net start SessionEnv net start SessionEnv
net start TermService net start TermService
net start UmRdpService net start UmRdpService