Skip to content
Go to file
This branch is 8 commits ahead, 9 commits behind Vidanez:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Deploying multiple Windows and/or Linux VMs using PowerCli

.DESCRIPTION VMs are deployed asynchronously based on a pre-configured csv file (DeployVM.csv) Designed to run from Powershell ISE

.PARAMETER csvfile Path to DeployVM.csv file with new VM info

.PARAMETER vCenter vCenter Server FQDN or IP

.PARAMETER auto Will allow script to run with no review or confirmation

.PARAMETER createcsv Generates a blank csv file - DeployVM.csv

.EXAMPLE .\DeployVM.ps1 Runs DeployVM

.EXAMPLE .\DeployVM.ps1 -vcenter my.vcenter.address Runs DeployVM specifying vCenter address

.EXAMPLE .\DeployVM.ps1 -csvfile "E:\Scripts\Deploy\DeployVM.csv" -vcenter my.vcenter.address -auto Runs DeployVM specifying path to csv file, vCenter address and no confirmation

.EXAMPLE .\DeployVM.ps1 -createcsv Creates a new/blank DeployVM.csv file in same directory as script

.NOTES Author: Shawn Masterson Created: May 2014 Version: 1.2

Author: JJ Vidanez Created: Nov 2014 Version: 1.3 Add creation onthefly for customization Spec for linux systems Ability to create machines names and guest hostname using different names Added a value to find out the kind of disk because powercli bug for SDRS reported at Remove the dependency for an already created OScustomization Spec

Author: JJ Vidanez Created: Jul 2015 Version: 1.4 Adding domain credential request for Windows systems

Author Simon Davies - Created May 2016 Version: 1.5 Adding AD Computer Account Creation in specified OU's for all VM's at start of deployment (This includes Linux as it was a requirment but this can be limited to Windows by removing the comment from line #261

REQUIREMENTS PowerShell v3 or greater vCenter (tested on 5.1/5.5/6.0) PowerCLI 5.5 R2 or later

CSV File - VM info with the following headers NameVM, Name, Boot, OSType, Template, CustSpec, Folder, ResourcePool, CPU, RAM, Disk2, Disk3, Disk4, SDRS, Datastore, DiskStorageFormat, NetType, Network, DHCP, IPAddress, SubnetMask, Gateway, pDNS, sDNS, Notes, Domain, OU

Must be named DeployVM.csv

Can be created with -createcsv switch

CSV Field Definitions

NameVM - Name of VMs

Name - Name of guest OS VM

Boot - Determines whether or not to boot the VM - Must be 'true' or 'false'

OSType - Must be 'Windows' or 'Linux'

Template - Name of existing template to clone

Folder - Folder in which to place VM in vCenter (optional)

ResourcePool - VM placement - can be a reasource pool, host or a cluster

CPU - Number of vCPU

RAM - Amount of RAM

Disk2 - Size of additional disk to add (GB)(optional)

Disk3 - Size of additional disk to add (GB)(optional)

Disk4 - Size of additional disk to add (GB)(optional)

SDRS - Mark to use a SDRS or not - Must be 'true' or 'false'

Datastore - Datastore placement - Can be a datastore or datastore cluster

DiskStorageFormat - Disk storage format - Must be 'Thin', 'Thick' or 'EagerZeroedThick' - Only funcional when SDRS = true

NetType - vSwitch type - Must be 'vSS' or 'vDS'

Network - Network/Port Group to connect NIC

DHCP - Use DHCP - Must be 'true' or 'false'

IPAddress - IP Address for NIC

SubnetMask - Subnet Mask for NIC

Gateway - Gateway for NIC

pDNS - Primary DNS must be populated

sDNS - Secondary NIC must be populated

Notes - Description applied to the vCenter Notes field on VM

Domain - DNS Domain must be populated

OU - Must be in Distinguished Name formate - eg "OU=TestOU1,OU=Servers,DC=my-homelab,DC=local"

CREDITS Handling New-VM Async - LucD - @LucD22





Deploying multiple VMs using PowerCli




No releases published
You can’t perform that action at this time.