Skip to main content

Offline Install VMware Powercli and creating multiple VMs from template

 

1.Save the powercli modules to any machine that have internet access:

open powerchell:

Save-Module -Name VMware.PowerCLI -Path C:\Path\



2.Now copy the module folders to offline system:

 C:\Program Files\WindowsPowerShell\Modules


3.Save below content to createVM.ps1 file and run:



********************


# Specify vCenter Server, vCenter Server username and vCenter Server user password

$vCenter="192.16.1.1"

$vCenterUser="administrator@ranji.com"

$vCenterUserPassword="Password"

#

$ESXi="<ESXI IP>"

#$ds = Get-Datastore -Name 'PSG2_DS'

$cloneName = "<Existing VM template>"

# Specify the VM name to the left of the - sign

$VM_prefix = "<NewVMName->"

$vm_count = "10"

#

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

write-host "Connecting to vCenter Server $vCenter" -foreground green

Connect-viserver $vCenter -user $vCenterUser -password $vCenterUserPassword -WarningAction 0

1..$vm_count | foreach {

$y="{0:D1}" -f + $_

$VM_name= $VM_prefix + $y

$ds = Get-Datastore -Name 'My_DS'

write-host "Creation of VM $VM_name initiated"  -foreground green


$vm = New-VM -Name $VM_name -VM $cloneName -Datastore $ds -VMHost $ESXi

write-host "Power On of the  VM $VM_name initiated"  -foreground green

Start-VM -VM $VM_name -confirm:$false -RunAsync

}

Comments

Popular posts from this blog

Deploy OVF fails Issues detected with selected template. Details: VALUE_ILLEGAL: No supported hardware versions among [virtualbox-2.2]; supported: [vmx-04, vmx-07, vmx-08, vmx-09, vmx-10, vmx-11, vmx-12, vmx-13, vmx-14, vmx-15, vmx-16, vmx-17, vmx-18, vmx-19].

 Error: While deploy using OVF file ,getting error as : Issues detected with selected template. Details: - -1:-1:VALUE_ILLEGAL: No supported hardware versions among [virtualbox-2.2]; supported: [vmx-04, vmx-07, vmx-08, vmx-09, vmx-10, vmx-11, vmx-12, vmx-13, vmx-14, vmx-15, vmx-16, vmx-17, vmx-18, vmx-19]. Solution: Open .OVF file and edit       <Info>Virtual hardware requirements for a virtual machine</Info>       <System>         <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>         <vssd:InstanceID>0</vssd:InstanceID>         <vssd:VirtualSystemIdentifier>zabbix_appliance-6.2.7</vssd:VirtualSystemIdentifier>         <vssd:VirtualSystemType> virtualbox-2.2 </vssd:VirtualSystemType>       </System> to  vmx-19       <Info>Virtual hardware requireme...

How to Open KVM oVirt Virtual machine console from windows

  To open virtual machine console from ovirt manager (KVM) 1. Download and Install ovirt-viewer from the below link:     https://virt-manager.org/download 2.From browser open ovirt engine and login to administrator portal 3.Right click the virtual machine and choose "Console" 4.Console file be getting created on your windows->downloads 5.Right click the file ->Properties and change the file "Opens With:" as a new program and browse till c:\program files->ovirt-viewer-> "Remote-Viewer" type 5.Now double click on the "Console.vv" file will open the console: