Wednesday, September 18, 2013

How to Create VM from Template with PowerShell CLI

new-vm -name MyNewVM -Template myVMtemplate1 -Location "Afolder" -datastore san001 -vmhost "esx001.mydomain.com"

Name                 PowerState Num CPUs MemoryGB    
----                 ---------- -------- --------    
dmoa522a             PoweredOff 1        4.000        


And since I want to reduce the memory to 2gb for this one, I just run this and also add note.

PS C:\scripts> set-vm MyNewVM -memoryGB 2 -notes "Test App Server: Java " -confirm:$false

Name                 PowerState Num CPUs MemoryGB    
----                 ---------- -------- --------    
MyNewVM             PoweredOff 1        2.000  

Then to verify my information
PS C:\scripts> get-vm MyNewVM |fl name, host, numcpu, memoryGB, notes


Name     : MyNewVM
Host     : esx001mydomain.com
NumCpu   : 1
MemoryGB : 2
Notes    : Test App Server: Java

No comments:

Post a Comment