May 03, 2023

New Run Commands for Azure VMware Solution - Q1 2023

There have been some fantastic updates to Run Commands for Azure VMware Solution in the past quarter. In this article we go over the details of the new cmdlets covering HCX, vSAN, VMware Tools, and DRS. 

There have been some fantastic updates to Run Commands for Azure VMware Solution this quarter, especially in the past month!

What are Run Commands?

In a traditional on-premises environment you might have access to the administrator@vsphere.local account, but in Azure VMware Solution, you have access to the cloudadmin@vsphere.local account. The CloudAdmin account has near admin privileges; enough to do pretty much everything you need, but in some cases, you will need temporary elevated privileges to accomplish additional administrative tasks.

Run commands are a feature within Azure that let you perform tasks and operations for your Azure VMware Solution Private Cloud through a collection of PowerShell cmdlets that would normally require those elevated privileges.

To use Run commands, simply login to the Azure portal, navigate to your Azure VMware Solution Private Cloud, under Operations, and select Run command. From there, expand Microsoft.AVS.Management to see a growing of list actions you can perform.

Simply select a cmdlet, fill out any required details, and click Run.

A screenshot of a computer</p>
<p>Description automatically generated with medium confidence

What’s new?

There are seven new cmdlets covering VMware HCX, VMware vSAN, VMware Tools, and DRS.

VMware HCX

  • Set-HcxScaledCpuAndMemorySetting
  • Restart-HcxManager

The default size for the HCX Cloud Manager deployed is 4 vCPUs and 12 GB of RAM. The Set-HcxScaledCpuAndMemorySetting cmdlet will increase the appliance size to 8 vCPUs and 24 GB of RAM. Scaling the appliance is important if you plan to use Mobility Optimized Networking (MON). The appliance will be rebooted during this process.

Restart-HcxManager is exactly what it sounds like. When run, the cmdlet checks for active replications or migrations, and then restarts the VM safely through the guest OS. There are additional force and hard reboot parameters if you’re having a particularly difficult time.

VMware vSAN

  • Set-vSANCompressDedupe
  • New-AVSStoragePolicy
  • Remove-AVSStoragePolicy

The new vSAN cmdlets provide administrators with greater flexibility and control over vSAN and storage policies.

Set-vSANCompressDedupe allows you to toggle compression and deduplication on the vSAN cluster. Deduplication and compression are already enabled on the vSAN cluster by default. However, now administrators can choose to disable both, or just disable deduplication, leaving only compression enabled. If deduplication is enabled, compression will be required, and is always enabled along with it. Enabling or disabling these features requires action on every physical disk, so this action will take some time to complete.

There are already several pre-defined storage policies available for customers to choose from and should meet the needs of most use cases right out of the box, however there are some instances where customers need to build specific policies. The New-AVSStoragePolicy function allows you to create new policies or overwrite existing ones with any combination of the following availability, storage rules, or advanced policy rules: FTT, site disaster tolerance, encryption, disk stripes per object, IOPS limit, object space reservation, flash read cache reservation, object checksum, and force provisioning.

Remove-AVSStoragePolicy does exactly what it says. When run, it deletes the specified storage policy.

VMware Tools

  • Set-ToolsRepo

Keeping VMware tools updated on your VMs is always important, and the easiest way to standardize on a particular version to streamline these updates is to make use of a centralized repository on a shared datastore. In this case, we’ll be using the vSAN datastore. The Set-ToolsRepo cmdlet will create a folder called tools-repo on the vSAN datastore and set the ProductLocker pointer for each ESXi host to this to this new folder. All you must do is download the zip file for the VMware tools version you want to use and provide a URL for the cmdlet to grab the zip file from. Check out the video below for a demo!




  • Set-CustomDRS

VMware DRS is managed by Microsoft, and configured as fully automated, with a migration threshold set to 3 by default. The DRS migration threshold has 5 settings from conservative to aggressive, and specifies which recommendations are generated and applied to VMs. This threshold is a measure of how aggressive DRS is in recommending migrations to improve VM happiness. While setting this threshold to 3 is generally recommended, some customers would like to take a slightly more conservative approach. In this case, customers can use the Set-CustomDRS cmdlet to change this setting on individual clusters to 4.


Microsoft continues to do an excellent job of providing additional features, capabilities, and flexibility through Azure Run Commands for administrators to fine tune their clusters without compromising the security and management they’re responsible for in the AVS private cloud.

For the latest technical content and demos for Azure VMware Solution, check out the AVS Landing Page on VMware Cloud Tech Zone.

Filter Tags

Operations and Management HCX vSAN Azure Services Azure VMware Solution Blog Technical Overview Manage