Run PowerShell Script on Azure VMs using VM Run

This Microsoft Azure blog post will show you how to run PowerShell scripts on an Azure VM directly without logging in.

VM Run

The Invoke-AzVMRunCommand is a cmdlet in the Azure PowerShell module. It allows you to run PowerShell scripts or PowerShell cmdlets directly on a virtual machine (VM) hosted in Azure without logging into it using RDP.

To run a PowerShell script on an Azure VM, follow these steps.

Login to Azure using Azure PowerShell

Run the following script with the details of your VM and the path to the script on your local machine.

You can use the parameters option if you need to pass parameters to your script using the following switch -Parameter






Leave a Reply

Your email address will not be published. Required fields are marked *

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