Difference between revisions of "Useful One-Liners (PowerCLI)"

Jump to navigation Jump to search
→‎Virtual Machine: Added "Move VMs to New PortGroup Network"
(→‎Storage: Added "Set LUN Multipathing")
(→‎Virtual Machine: Added "Move VMs to New PortGroup Network")
Line 43: Line 43:
=== Get Snapshot info for a VM ===
=== Get Snapshot info for a VM ===
Get Snapshot size, date created, and other info for a VM
Get Snapshot size, date created, and other info for a VM
<source lang="powershell"> Get-VM MyVM | Get-Snapshot | Select-Object -Property Name, Description, Created, SizeMB | Format-List * </source>  
<source lang="powershell"> Get-VM MyVM | Get-Snapshot | Select-Object -Property Name, Description, Created, SizeMB | Format-List * </source>
 
=== Move VMs to New PortGroup Network ===
The following will reconfigure all VM in the specified folder to move from network A to network B
<source lang="powershell"> Get-VM -Location (Get-Folder "InThisFolder") | Get-NetworkAdapter | Where {$_.N
etworkName -eq "Network A"} | Set-NetworkAdapter -NetworkName "Network B" -Confirm:$false </source>
Borrowed in part from http://www.virtu-al.net/2009/10/19/powercli-mass-vm-portgroup-change/


== ESX Host ==
== ESX Host ==

Navigation menu