6.1.1

Table Of Contents
n
Administrator login name for the vCenter Server
n
Administrator password for the vCenter Server
n
Clone type, which can be linked or full
n
Whether to disable vSphere VM console
Script Content
<#
.SYNOPSIS
Create Clones from a Master VM
.DESCRIPTION
The Tool supports creation of Full clone and linked clone from Master VM
The parent VM is required for the linked-clone to work and the parent VMs file cannot be renamed
or Moved
.NOTES
#>
#------------ Functions --------------------------
function IsVMExists ($VMExists)
{
Write-Host "Checking if the VM $VMExists already Exists"
[bool]$Exists = $false
#Get all VMS and check if the VMs is already present in VC
$listvm = Get-vm
foreach ($lvm in $listvm)
{
if($VMExists -eq $lvm.Name )
{
$Exists = $true
}
}
return $Exists
}
function Disable_VM_Console($VMToDisableConsole)
{
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$extra = New-Object VMware.Vim.optionvalue
$extra.Key="RemoteDisplay.maxConnections"
$extra.Value="0"
$vmConfigSpec.extraconfig += $extra
$vm = Get-VM $VMToDisableConsole | Get-View
$vm.ReconfigVM($vmConfigSpec)
}
function Delete_VM($VMToDelete)
{
Write-Host "Deleting VM $VMToDelete"
Get-VM $VMToDelete | where { $_.PowerState –eq "PoweredOn" } | Stop-VM –confirm:$false
Get-VM $VMToDelete | Remove-VM –DeleteFromDisk –confirm:$false
Setting Up Horizon 6 for Linux Desktops
26 VMware, Inc.