Hi,
I have been working on this script to create a linked clone with a certain customization. All good there but something basic as getting a popupbox asking me to to deploy to which cluster? and which cluster datastorage (and thus list them for me) i can't figure how to do this?
In the script i can hardcode the $cluster and $datastoreclustername but i would like a prompt for this
Below is the top part of the script i am currently having:
Connect-VIServer "vcenter.domain"
$sourceVM = Get-VM "test-replica" | Get-View
$agentTotal = 10
$totalXPCount = (Get-VM -Name test* | Measure-Object).Count
if($totalXPCount -lt $agentTotal){
for($adt = $totalXPCount + 1; $adt -le $agentTotal; $adt++){ $cloneName = "test1{0:0##}" -f ($adt+13) $cloneFolder = $sourceVM.parent $cluster = Read-Host "Enter vCenter Cluster: " #$cluster = "cluster-3" $datastoreclustername = "cluster-3-bronze" foreach ($vm in $cloneName){ $cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec $cloneSpec.Snapshot = $sourceVM.Snapshot.CurrentSnapshot $cloneSpec.Location = new-object Vmware.Vim.VirtualMachineRelocateSpec $cloneSpec.Location.DiskMoveType = [Vmware.Vim.VirtualMachineRelocateDiskMoveOptions]::createNewChildDiskBacking $cloneSpec.Location.Host = (Get-Cluster -Name $cluster).MoRef $cloneSpec.Location.Datastore = (Get-DatastoreCluster -Name $datastoreclustername).Extensiondata.MoRef
Ah how do i get the fancy colours from the PowerCli?