Saturday, March 5, 2016

VMware PowerCLI create vm in simple way

#vm name is supposed to be here
$vmname="tech-jockey-vm1","tech-jockey-vm2","tech-jockey-vm3"

#Template name is supposed to be here
$TL="RHEL7"
$TW="Windows_Srv_2012"
clear
#Host name is supposed to be here                                          
$host01="tech-jockey-host01"
$host02="tech-jockey-host02"

foreach($vm in $vmname)
{

write-host "Creating VM..."
echo $vm

new-vm -Name $vm -Template $TL -VMHost ( Get-VMHost -Name $host01 ) -Location ( Get-Folder -name New_VM) -Datastore tech-jockey-lun01

#Start-Sleep -s 60
write-host "Created VM..."
echo $vm
}

No comments:

Post a Comment

Thanks for showing interest in tech-jockey.

Content of this blog has been moved to GITHUB

Looking at current trends and to make my content more reachable to people, I am moving all the content of my blog https://tech-jockey.blogsp...