Difference between revisions of "PowerCLI Powerhsell"

From Michael's Information Zone
Jump to navigation Jump to search
Line 12: Line 12:
 
<pre>
 
<pre>
 
new-vm -name <new_machine_name> -vm <source_machine_name> -vmhost <ip or host name of the physical host, not the controller>
 
new-vm -name <new_machine_name> -vm <source_machine_name> -vmhost <ip or host name of the physical host, not the controller>
 +
</pre>
 +
==Delete VM==
 +
<pre>
 +
remote-vm -vm <namme_of_vm> -deletepermanently  -confirm $false
 
</pre>
 
</pre>

Revision as of 09:07, 31 May 2017

Allow powershell to run powercli cmdlets

Set-ExecutionPolicy RemoteSigned

Log into the server and start using commands

$cred=get-credential
connect-viserver -server localhost -credential $cred
get-vm

Clone VM

new-vm -name <new_machine_name> -vm <source_machine_name> -vmhost <ip or host name of the physical host, not the controller>

Delete VM

remote-vm -vm <namme_of_vm> -deletepermanently  -confirm $false