Book Image

Microsoft Hyper-V PowerShell Automation

By : Vinith Menon
Book Image

Microsoft Hyper-V PowerShell Automation

By: Vinith Menon

Overview of this book

Table of Contents (13 chapters)
Microsoft Hyper-V PowerShell Automation
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating reusable scripts to automate installation of Integration Service in virtual machines


Next, we will look at some scripts that can be used to automate the installation of Integration Service in virtual machines. These scripts support Windows Server 2012, Hyper-V Version 3, and their later versions from the perspective of Microsoft hypervisor.

This example is illustrated as follows by creating a function that gets Integration Service installed.

Let's consider four parameters for this function, which include the virtual machine name, the Hyper-V hostname, the username, and the password:

function Install-VMIntegrationService 
{
    [CmdletBinding()] 
    
    Param 
    ( 
      # Param1 help description 
      [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)] 
        $VMName, 
 
        # Param2 help description 
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=1)] 
        $VMComputerName, 
 
          # Param2 help description...