TL;DR — Kurzzusammenfassung
Learn re-enable remote desktop with powershell after you've blocked it with your own firewall rule. How to: Re-enable Remote Desktop with <
Hinweis: Dieser Artikel wurde ursprünglich veröffentlicht in 2013. Einige Schritte, Befehle oder Softwareversionen haben sich möglicherweise geändert. Überprüfen Sie die aktuelle Dokumentation von Windows Azure Cloud für die neuesten Informationen.
Voraussetzungen
Bevor Sie beginnen, stellen Sie sicher, dass Sie Folgendes haben:
- Windows Server 2012 or 2012 R2
- Administrator privileges
- Server Manager access
How to: Re-enable Remote Desktop with (https://www.microsoft.com/powershell “Windows PowerShell”) after you’ve blocked it with your own firewall rule
Obtained from: https://www.hanselman.com/blog/CSIReenablingRemoteDesktopWithPowerShellAfterYouveBlockedItWithYourOwnFirewallRule.aspx The Big Problem:
I set up an Azure (https://en.wikipedia.org/wiki/Virtual_machine “Virtual machine”) running (https://www.microsoft.com/en-us/server-cloud/windows-server/default.aspx “Windows Server 2012”). I accidentally disabled the Remote Desktop (https://en.wikipedia.org/wiki/Windows_Firewall “Windows Firewall”) rule (while I was remotely connected). The connection dropped as you would expect. I have been pulling my hair out ever since trying to re-enable this rule.
Doh. Ouch. I didn’t ask how this happened, but you know, one gets to clicking and typing and you can feel the mistake about to happen as your hand drops towards the keyboard, but by then it’s too late. Gravity has screwed you. I suggested that Seán use (https://learn.microsoft.com/en-us/magazine/ff700227.aspx). Remote PowerShell is like “(https://en.wikipedia.org/wiki/Secure_Shell “Secure Shell”)” in *nix. You get a remote terminal and can pretty much do whatever you want from there.
TL;DR VERSION OF SEÁN’S EXPERIENCE.
- Make sure PowerShell is enabled in the Endpoints section of the Azure portal.
- Get the server’s certificate (PowerShell needs this for remote commands). You can get the server certificate by going to your domains’ (https://en.wikipedia.org/wiki/Uniform_resource_locator “Uniform resource locator”):
https://yourdomain.cloudapp.net:12345(where :12345 is the port that PowerShell uses). - Export the SSL certificate of the site as a .CER file and install it on your local machine.
- Save it to the “Trusted Root Certification Authorities” store on your machine.
- Open PowerShell with administrative privileges on your local machine and type:
Enter-PSSession -ComputerName yourdomain.cloudapp.net -Port 5986 -Credential YourUserName -UseSSL - A login popup will appear, enter your VM’s login credentials here.
- You will now be able to execute commands against the Azure VM. In Seán’s case, he ran
netsh advfirewall firewall set rule group="remote desktop" new enable=Yesand exited the PowerShell session and was able to remotely connect to my machine.
LONG DETAILED VERSION WITH SCREENSHOTS
Zusammenfassung
Verwandte Artikel
- How to: Enable proper domain DNS search in Ubuntu when using Windows Azure
- How to: Enable Shadow Copy or Previous Version in Windows 2012 R2?
- Error deleting VHD: There is currently a lease on the Blob and no lease ID was specified in the request
- How to: Make my DNS server resolve my WPAD entry for my proxy server and what is the DNS Block List?