This document to describe the steps to deploy multiple
VM’s from template by using VMware PowerCLI.
1- Create a Customization
Specification for Windows:
- Using Guest Customization wizard to save Windows guest operating system settings in a specification that you can apply when deploying from templates.
- Using vSphere PowerCLI Cmdlets [New-OCCustomizationSpec] to create a new OS customization specification.
Prerequisites
The most current
version of VMware Tools must be installed on the virtual machine or template to
customize the guest operating system during cloning or deployment.
Virtual Disk Requirements
The guest operating
system being customized must be installed on a disk attached as SCSI node 0:0
in the virtual machine configuration.
Windows Requirements
Customization of
Windows guest operating systems requires the following conditions:
■
|
Microsoft Sysprep
tools must be installed on the vCenter Server system. See Installing the Microsoft Sysprep Tools.
|
■
|
The ESX/ESXi host
that the virtual machine is running on must be 3.5 or later.
|
Guest operating system customization is supported on multiple Windows
operating systems. To verify customization support for Windows operating
systems and compatible ESX/ESXi hosts.
Windows Server 2008, Windows Server 2008 R2 and Windows 7 Microsoft Sysprep
Preparation tools are built into the
operating system and do not have to be downloaded.
2-
Deploying the Templates:
Launching vSphere PowerCLI to get a connection to a
vCenter Server system.
To get started, call the Connect-VIServer cmdlet and specify the IP address or DNS name of your vCenter Server
system or ESX host, the protocol (http or https), user name, and password.
Connect-VIServer –Server [VCenter IP
or Name] –Protocol https –User admin –Password mypass
Once your server session is established, prepare
the script.\
3-
Script:
To build the script this is a prerequisite:
-vmhost = Target host FQDN;
-Name = Name of new VM;
-Template: From which template you want to
deploy the new VM;
-Datastore: Target datastore to place the
new VM;
-OSCustomizationspec = created previous for
deploying the new VM;
- New-vm -vmhost Target host FQDN -Name FS-SVR02 -Template w2008-r2-std-tmp -Datastore datastore2 -OSCustomizationspec WIN2008R2_Template
- New-vm -vmhost Target host FQDN -Name FS-SVR02 -Template w2008-r2-std-tmp -Datastore datastore2 -OSCustomizationspec WIN2008R2_Template
- New-vm -vmhost Target host FQDN -Name FS-SVR02 -Template w2008-r2-std-tmp -Datastore datastore2 -OSCustomizationspec WIN2008R2_Template
- New-vm -vmhost Target host FQDN -Name FS-SVR02 -Template w2008-r2-std-tmp -Datastore datastore2 -OSCustomizationspec WIN2008R2_Template
-Save as: FileserverDeploy.ps1
4-
PowerCLI:
Running the script:
If the Host is working in a cluster
environment once the VM powered on it will show the below message to select on
which host the machine will power on.
No comments:
Post a Comment