How to deploy VM from Powershell


Issue

Virtual Machine deployment from Power shell command line with screenshot 

Environment

Astro 2020 and upwards releases that uses power shell to deploy Virtual Machines.

Resolution

Please also check the SCREENSHOTS after the procedure-Using ATR as an example, screenshot of EACH steps to deploy Virtual Machines using Power Shell.  

 

Open the PowerShell console with administrative privileges by performing the following actions:
a. Right-click Start and select Search.
b. Type in: powershell
c. Right-click Windows PowerShell and select Run as administrator.
d. If the User Account Control window appears, click Yes.
e. If you are not logged on with an administrative account, enter the admin credentials

4. At the PowerShell prompt, enter:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore- Y

 

Perform one of the following actions:
● To establish the connection to the VMware ESXi server on which you want to deploy the VM in
standalone mode, enter:
Connect-VIServer –Server <IP_address>
where <IP_Address> is the IP address of the VMware ESXi server's Network Management
interface.

 For standalone mode, provide the credentials for the root user on the VMS.

8. Define the variable for the IP address of the VMware ESXi server's Network Management interface by
entering:
$vmhost = Get-VMHost -Name <IP_address
$vmhost = Get-VMHost -name 10.1.233.121

9. Define the variable for the datastore on which the VM is to be deployed by entering:


$datastore = Get-Datastore -Name '<datastore>'
where <datastore> is: See below SO

● z00<X>das<YY>_datastore2 for Unified Network Configurator Device Server (UNCDS) and
High Capacity Unified Network Configurator (UNC) servers

● z00<X>das<YY>_datastore1 for other servers
<X> is the zone number. The possible values are: 1 to 7.
<YY> is the instance of the Direct Attached Storage (DAS)

SO 

$datastore = Get-Datastore -Name z00<X>das<YY>_datastore1

$datastore = Get-Datastore -Name z001das01_datastore1

 

10. Deploy the VM by entering:
Import-VApp -Name '<VM_name>' –VMHost $vmhost –Datastore $datastore
-DiskStorageFormat EagerZeroedThick
Step example: VM names: ucs01.ucs, atr01.zone1

Import-VApp -Name atr01.zone1 -VMHost $vmhost -Datastore $datastore -DiskStorageFormat EagerZeroedThick

ovf path 
G:\ATR-Astro-07.31.02.45-00\ATR-Astro-07.31.02.45-00.ovf
ATR znm1

Except for UNC- cpu memory default

Then same as old version- follow steps.

SCREENSHOTS- Total 8 SCREENSHOTS.

SCREENSHOT- 1

 

SCREENSHOT-2

 

SCREENSHOT-3

 

SCREENSHOT-4

 

SCREENSHOT-5

 

SCREENSHOT-6

 

SCREENSHOT-7

 

SCREENSHOT-8