Difference between revisions of "Script Extracts and Examples (PowerCLI)"

Jump to navigation Jump to search
→‎Virtual Machine: Added Snapshot info
(→‎Getting Started: Added "Installed Version")
(→‎Virtual Machine: Added Snapshot info)
Line 102: Line 102:
! Command    !! Description
! Command    !! Description
|-
|-
| <code> get-vm </code>  
| <code> Get-VM </code>  
| Get list of VM's
| Get list of VM's
|-
|-
| <code> get-vm <nowiki>|</nowiki> sort -property Name </code>  
| <code> Get-VM <nowiki>|</nowiki> Sort -Property Name </code>  
| Get list of VM's, sorted by name
| Get list of VM's, sorted by name
|-
|-
| <code> get-vm -name "MyVM" -location (Get-Folder -Name "MyFolder") </code>  
| <code> Get-VM -Name MyVM -Location (Get-Folder -Name "MyFolder") </code>  
| Get VM within a specific folder (for when you've VM's with identical names if different folders)
| Get VM within a specific folder (for when you've VM's with identical names if different folders)
|-
|-
| <code> get-vmguest -VM (get-vm -name "vserver1") </code>  
| <code> Get-VMGuest -VM (get-vm -name MyVM) </code>  
| Get VM guest info (IP address, OS)
| Get VM guest info (IP address, OS)
|-
|-
| <code> Get-VM "vserver1" <nowiki>|</nowiki> %{(Get-View $_.Id).config.uuid} </code>  
| <code> Get-VM MyVM <nowiki>|</nowiki> %{(Get-View $_.Id).config.uuid} </code>  
| Get VM's UUID
| Get VM's UUID
|-
|-
| <code> Get-VM "MyVM" <nowiki>|</nowiki> Move-VM -datastore (Get-datastore "DestinationDatastore") </code>  
| <code> Get-VM MyVM <nowiki>|</nowiki> Move-VM -datastore (Get-datastore "DestinationDatastore") </code>  
| Storage VMotion
| Storage VMotion
|-
|-
Line 123: Line 123:
| Sends OS shutdown command via VM Tools
| Sends OS shutdown command via VM Tools
|-
|-
| <code> get-VM "vserver1" <nowiki>|</nowiki> Get-VIEvent <nowiki>|</nowiki> Where {$_.fullFormattedMessage -like "*Power*"} </code>  
| <code> get-VM MyVM <nowiki>|</nowiki> Get-VIEvent <nowiki>|</nowiki> Where {$_.fullFormattedMessage -like "*Power*"} </code>  
| Get Power On/Off events for VM
| Get Power On/Off events for VM
|-
| <code> Get-VM MyVM <nowiki>|</nowiki> Get-Snapshot <nowiki>|</nowiki> Select-Object -Property Name, Description, Created, SizeMB <nowiki>|</nowiki> Format-List * </code>
| Get Snapshot info for a VM
|}
|}


Navigation menu