Add the Azure VM agent to existing Virtual Machines

Here is a quick rundown of how to add the base VM agent to existing Azure VMs:

Find all your VMs that currently do not have the agent installed:Get-AzureVM | where { $_.GuestAgentStatus -eq $null }or this variation if you only want to get the VMs that are actually running:Get-AzureVM | where { $_.GuestAgentStatus -eq $null -and $_.Status -eq “ReadyRole”}

Install the agent bits on the VM
Azure does not provide a way to inject the agent into an existing VM, AFAIK, but you can use any number of ways to push it out. You can download the agent here http://aka.ms/vmagentwin. I use the following command line to silently install the agent:msiexec.exe /package WindowsAzureVmAgent.2.3.1198.670.rd_art_stable.140328-0941.fre.msi /passivePro Tip: Use Azure Files to store the files and scripts you use. That makes them readily accessible to you VMs, with the added benefit of not having to maintain a file server.

Check the status of the guest agent for all VMs:Get-AzureVM | select -Property ServiceName,Name,@{Name=”GuestAgentStatus”; Expression={$_.GuestAgentStatus.Status}}
Every VM with the agent installed should report a value for Ready in the GuestAgentStatus column.