Access Azure VM when network is not working

There are several ways which are causing the an azure vm to be not accessible any more. This can be a blocking software (e.g. netlimiter) or a misconfigured firewall. To still access the vm we need to run command via powershell. This is how this can be achieved

Option 1: Run a powershell command

In the menu of a Azure VM we find the Run Command. This can be beside some default actions also the command „RunPowerShellScript“. With this we can modify the machine in the way that it’s accessible again

Option 2: Open an interactive Powershell

Often it is easier to open an interactive powershell window on the machine. For this select „Serial console“ in the help section of the vm menu

here open a command

ch -si 1

Enter the username and password of an admin user. Ignore the domain if the vm is not part of any. With this you get a command promt. From here you can start a powershell

3. Sample: Deinstall a program

$Software=get-wmiobject Win32_Product -Filter "Name = 'samplesoftware'"