Azure Compute

Azure VMs: Run Command

#microsoft #Azure #AzureCommunity #Rcloudweb #MicrosoftMVP #MVPbuzz #Azure #AzureStack #Cloud #HybridCloud

I am Happy and surprised to see , Microsoft commitments towards improvements of the services are quite amazing, I am using MS Azure services since when it is classic model (ASM) and it’s has very limited feature but when MS has started his “Resource Manager Journey”, It’s improving the lots of services  and adding new feature day on day.

I am little bit surprise with this new Feature “Run Command” which is enable in Azure VMs Operations properties ,it’s will provide the “Powershell to execute the command,  can enable the Administrator accounts and even more you can reset the password , set the remote ports” and many more which can’t be done through portal earlier.

Which will generally help to troubleshot the VMs related query.

Now you can easily get the IP configuration from the portal and enables lots of new below mention things. Below are list of the commands.




Executes a PowerShell script


Enable administrator account


Enable remote PowerShell

List IP configuration


Verify RDP Listener Settings


Reset built-in Administrator account password


Restore RDP Authentication mode to defaults


Set Remote Desktop port

I am writing in my blogs how you can enable the those features.

Step:1  Run the Powershell script .

  • Click on the VMs which you want to enable the Run Commands.
  • Co to Operations and select the Run Command.
  • Select the PowerShell script to Run.

first screenshot.jpg

  • Select the PowerShell Script
  • Please Write or Past the PowerShell script .
  • Run the Powershell Commands for the same.
  • You will get an output in “Black” Screen.


Step:2  Enabling Admin Accounts .

If you missed or forget an user ID and password or required to enable the run command you can enable it from the portal.

  • Click on EnableAdminAccount
  • Select script
  • Click on Run , your admin account will be enabled.


Step:3  Enable-RemotePS

Enable-PSRemoting cmdlet help the computer to receive Windows PowerShell remote commands.

  • Click on the RemotePS command
  • Run the Script
  • Then remote PS command will get enabled.

runcommd remote PS.jpg

Step:4  IP-Config details 

In Most of the cases if VMs are down due to some  changes we are unable to track the change in that case you will get IPConfig/All details from this command.

  • Click on Run Command.
  • Click on IP config
  • Click on the script
  • Run the Script .


Step:5  RDS Settings 

If you want to what is your VMs RDP setting you can run this commandlets.

  • Click on Run Command.
  • Click on RDP Settings
  • Click on the script
  • Run the Script .


Step:6 Reset Admin Accounts Passwords

If you forget your administrator user account password, then using this command you can reset the password.

  • Click on Run Command.
  • Click on ResetAccountPassword
  • Click on the script
  • Run the Script .

user Name and password reset.jpg

Step:7 Reset RDcert

  • Click on Run Command.
  • Click on ResetRDcert
  • Click on the script
  • Run the Script .

resetRDP cert.jpg

Step:8 Reset RDP Ports

If some has changed the RDP ports , then you can reset from the below commands.

  • Click on Run Command.
  • Click on ResetRDP Port
  • Click on the script
  • Run the Script .

reset RDP POrt.jpg


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.