Hello @Daniel Call ,
Thanks for your query.
In general if you want to change the registry key using power shell by logging into Azure VM you can use below command: (in Power Shell prompt)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost' -Name 3G -Value 2
If you have multiple Virtual Machines and with out logging into the machine for changing Registry keys remotely please use below steps:
1) Create a powe rshell script file with name EditReg.ps1 enter the below code in that script file:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost' -Name 3G -Value 2
2) Now run the below command in the Azure CLI prompt:
Invoke-AzVMRunCommand -ResourceGroupName "win10" -Name "win10" -CommandId "RunPowerShellScript" -ScriptPath .\EditReg.ps1
Above is the azure powershell cmdlet which is mainly used to run powershell scripts remotely on an azure VM. (make sure to pass your resource group name and Azure VM Name)
Example of my testing locally:
After running the above command:
Test it out for one of the Azure VM.
Kindly let us know if you have additional questions !