Manage Hyper-V Integration Services with PowerShell

Manage Hyper-V Integration Services with PowerShell

 

Hyper-V Integration Services enhance virtual machine performance and provide convenience features by leveraging two-way communication with the Hyper-V host. Below, we’ll explain a few steps to manage the Integration Services through PowerShell.

Turn an integration service on or off using PowerShell

To do this in PowerShell, use Enable-VMIntegrationService and Disable-VMIntegrationService.

The following examples demonstrate turning the guest file copy integration service on and off for a virtual machine named "demovm".

Get a list of running integration services:

  • Get-VMIntegrationService -VMName "DemoVM"

The output should look like this:

Verify that Guest Service Interface is enabled:

  • Get-VMIntegrationService -VMName "DemoVM"

Turn off Guest Service Interface:

  • Disable-VMIntegrationService -VMName "DemoVM" -Name "Guest Service Interface"

 

Manage Integration Services from the host with PowerShell

Before starting to manage, here are the modules we can use from PowerShell for Integration Services.

  • Open PowerShell as Administrator
  • Run the command 
    Get-Command –Module Hyper-V -Name *integration*

Here are a few examples of how to use these modules.

  • Let's output a list with the Integration Services from specific Virtual Machine
    Get-VMIntegrationService -VMName "WIN2012-DC"

  • Let's output a list with a status of Integration Services for all Virtual Machines in Hyper-V Host
    Get-VMIntegrationService -VMName *

  • Integration Services can also be enabled or disabled from PowerShell by running the following commands. Let's disable the Shutdown Integration Service from a specific VM.

Disable-VMIntegrationservice -name Shutdown -vmname "win2008r2dc"

  • After disabling the Shutdown Integration Service, attempting to shut down the Virtual Machine from Hyper-V Manager at will fail. 
  • Let's enable the Shutdown Integration Service.
    Enable-VMIntegrationservice -name Shutdown -vmname "win2008r2dc"

 

Manage Integration Services from Guest (OS)

Run the following command to see all the VM services installed.

Get-Service -Name VM*

By using the Start-Service and Stop-Service you can start and stop each service with the following commands.

Ex: stop-service <service_name>

Stop-Service vmicshutdown

Start-Service vmicshutdown

 

Check Version of Integration Services

Here is how to check the installed integration services version for each VM.

  • Open PowerShell as Administrator.
  • Run the following command
    Get-VM | ft Name, IntegrationServicesVersion