6.2

Table Of Contents
$task = $vm.CloneVM_Task($vm.parent, $destVMName, $cloneSpec)
# Get the task object
$task = Get-Task | where { $_.id -eq $task }
#Wait for the taks to Complete
Wait-Task -Task $task
$newvm = Get-vm $destVMName
$customSpec = Get-OSCustomizationSpec $cSpec
Set-vm -OSCustomizationSpec $cSpec -vm $newvm -confirm:$false
if ($disableVMConsole -eq "yes")
{
Disable_VM_Console($destVMName)
}
# Start the VM
Start-VM $newvm
}
Disconnect-VIServer $vcAddress -Confirm:$false
exit
Script Execution
The following messages are from an execution of the script:
PowerCLI C:\scripts> .\CloneVMs.ps1
Your vCenter address: 10.117.44.17
Your vCenter admin user name: administrator
Your vCenter admin user password: *******
Clone Type<"linked" or "Full"> : linked
Disable vSphere VM Console ("yes" or "no", recommend "yes") : yes
The time that the cloning process takes depends on the number of desktop machines and can range from
several minutes to a number of hours. To verify that the process is complete, from vSphere client, make sure
that the last desktop virtual machine is powered on and VMware Tools is running.
Sample PowerCLI Script to Install View Agent on Linux Desktops
You can customize and use the following sample script to install View Agent on any number of Linux
desktop machines.
Before you run the script, make sure that View Agent is not already installed on the desktop machines.
To copy and paste the script content without page breaks, use the HTML version of this topic, available
from the Horizon 6 documentation page at https://www.vmware.com/support/pubs/view_pubs.html.
Script Input
This script reads one input file, which is described in “Input File for the Sample PowerCLI Scripts to Deploy
Linux Desktops,” on page 35. This script also interactively asks for the following information:
n
Acceptance of View Agent EULA (end user license agreement)
n
IP address of the vCenter Server
n
Administrator login name for the vCenter Server
n
Administrator password for the vCenter Server
n
Administrator login name for the ESXi host
n
Administrator password for the ESXi host
Chapter 3 Bulk Deployment of Horizon 6 for Linux Desktops
VMware, Inc. 39