Imagine a situation where you cannot access your virtual machines through VM console and there is no RDP enabled and your Critical Application is Down.
Enable RDP Remotely Using PowerShell
First of all, we need to establish a session with the remote server by following below command and it will prompt for the password, and you have type the password to get access
Establish a session with Remote Session
Enter-PSSession -ComputerName server.domain.local -Credential domain\administrator
Note:- You can see from the screen as connection established and the session is with the Server Name [VMARENA-BKP-01] : PS
Enable Remote Desktop
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
Activate the firewall rule
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Enable authentication via RDP
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1
Now try to do a Remote Desktop session, it will work.