This documentation is archived and is not being maintained.


Updated: January 22, 2009

Applies To: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1

The following script checks all the virtual machines that are managed by the System Center Virtual Machine Manager (VMM) server to determine whether virtual guest services are installed. If they are not installed, the script installs Integration Components on virtual machines that reside on Hyper-V hosts and Virtual Machine Additions on virtual machines that reside on Virtual Server hosts. For an explanation of this script, see How to Install Virtual Guest Services Using a Script.


# Filename:         InstallVirtualGuestServices.ps1
# Description:      Finds all virtual machines managed by Virtual Machine
#                   Manager on which virtual guest services are not 
#                   installed and installs the appropriate service.

# Connect to the Virtual Machine Manager server.

$VMMServer = Get-VMMServer -ComputerName ""

# Find all virtual machines without virtual guest services.

$VMs = @(Get-VM)
$VMsWithoutServices = @($VMs | where { $_.HasVMAdditions -eq $False })

if ($VMsWithoutServices.Count -eq "0") { throw "All virtual machines have virtual guest services installed." }

# Install virtual guest services on all the computers in the array.

foreach ($VM in $VMsWithoutServices)
     Set-VM –VM $vm –InstallVirtualizationGuestServices $TRUE -RunAsynchronously