Connect to an ESX/i or vCenter server (PowerCLI) | Connect-VIServer $ESXHost = "esxi01.vmeduc.com"||Connect-VIServer $ESXHost Example: |
Store an ESX/i or vCenter login credential for later use (PowerCLI) | Get-Credential $ESXCred = Get-Credential Example: |
Disconnect from an ESX/i or vCenter server (PowerCLI) | Disconnect-VIServer $ESXHost = "esxi01.vmeduc.com"||Disconnect-VIServer $ESXHost Example: |
Verify a PowerCLI connection to vCenter and list vCenter-controlled ESX/i hosts | Get-VMHost Get-VMHost "esxi01.vmeduc.com" Example: |
Retrieve interactive help on PowerCLI commands in the PowerCLI window | Get-Help Get-Help||Get-Help Connect-VIServer Examples: |
Create a new Datacenter in vCenter (PowerCLI) | New-DataCenter New-DataCenter -Location (Get-Folder -NoRecursion) -Name MyNewDatacenter Example: |
Retrieve information about Datacenters (PowerCLI) | Get-DataCenter Get-DataCenter Example: |
Add a new ESX/i server to vCenter (PowerCLI) | Add-VMHost $ESXHost = "esxi01.vmeduc.com"||$ESXCred = Get-Credential||Add-VMHost $ESXHost -Credential $ESXCred|-Location MyNewDatacenter -force:$true Example: |
Store vCenter credentials into an encrypted file: Credentials.xml (PowerCLI) | New-VICredentialStoreItem $vc = "vc-owl01.vmeduc.com"||New-VICredentialStoreItem -Host $vc|-User Administrator -Password vmware|-File C:\Credentials.xml Example: |
Retrieve credentials from the file Credentials.xml storing it into a PowerCLI variable: Credentials.xml | Get-VICredentialStoreItem $vc = "vc-owl01.vmeduc.com"||$cred = Get-CredentialStoreItem -Host $vc|-File C:\Credentials.xml Example: |
Log into vCenter using credentials stored in the object $cred (PowerCLI) | Connect-VIServer $vc = "vc-owl01.vmeduc.com"||Connect-VIServer $vc -User $cred.User|-Password $cred.Password Example: |
Retrieve a list of PowerCLI cmdlets | Get-VICommand Get-VICommand||Get-VICommand | more Examples: |
Get PowerCLI examples on creating a new virtual machine | Get-Help Get-Help New-VM -examples Example: |
Get the full PowerCLI help text on creating a new virtual machine | Get-Help Get-Help New-VM -Full||Get-Help New-VM -Full | more Examples: |
List the properties and members of a PowerCLI ESX/i host object | Get-Member Get-VMHost "esxi01.vmeduc.com" ||Get-Member Example: |
Extract a property from an ESX/i host (PowerCLI) | Get-VMHost $oESXHost = Get-VMHost "esxi01.vmeduc.com"||$oESXHost.NumCpu||$oESXHost.MemoryTotalMB||$oESXHost.ProcessorType||$oESXHost.Version Examples: |
Display the PowerCLI GUI-based help file | Get-PowerCLIHelp Get-PowerCLIHelp Example: |
List the physical NICs on an ESX/i host (PowerCLI) | Get-VMHostNetwork $ESXHost = "esxi01.vmeduc.com"||Get-VMHost $ESXHost | Get-VMHostNetwork | Select-Object -ExpandProperty PhysicalNIC Example: |
List the physical NICs which are in use on an ESX/i host (PowerCLI) | Get-VMHostNetwork $ESXHost = "vc-owl01.vmeduc.com"||Get-VMHost $ESXHost | Get-VMHostNetwork | Select-Object -ExpandProperty VirtualSwitch | Select-Object Name, Nic Example: |
Create a new virtual switch (PowerCLI) | New-VirtualSwitch $pnic = (Get-VMHostNetwork|-VMHost $VMHost).PhysicalNIC[0]||$newSwitch = New-VirtualSwitch|-VMhost $oESXHost|-Nic $pnic.DeviceName -NumPorts 64|-Name vSwitch1 Example: |
Create a new port group on an existing virtual switch $switch (PowerCLI) | New-VirtualPortGroup New-VirtualPortGroup -Name Production -VirtualSwitch $switch Example: |
Display a virtual switch (PowerCLI) | Get-VirtualSwitch Get-VirtualSwitch -VMhost $oESXHost Example: |
Create and enable a VMotion port on a virtual switch (PowerCLI) | New-VMHostNetworkAdapter $pnic = (Get-VMHostNetwork|-VMHost $oESXHost).PhysicalNIC[3]||$switch = New-VirtualSwitch -VMHost $oESXHost|-Nic $pnic.DeviceName -NumPorts 64 -Name vSwitch3||$pg = New-VirtualPortGroup -Name vMotion|-VirtualSwitch $switch||New-VMHostNetworkAdapter -VMHost $oESXHost|-PortGroup $pg -VirtualSwitch $switch -IP 10.0.0.1|-SubnetMask 255.255.255.0 -vMotionEnabled:$true Example: |
Enable vMotion on an ESX/i host (PowerCLI) | Set-VMHostAdvancedConfiguration $ESXHost = "esxi01.vmeduc.com" ||Get-VMHost $ESXHost ||Set-VMHostAdvancedConfiguration|-Name Migrate.Enabled -Value 1 Example: |
Add a VMKernel port to an existing virtual switch for NFS data access (PowerCLI) | New-VMHostNetworkAdapter $pg = New-VirtualPortGroup -Name NFSAccess -VirtualSwitch $switch||New-VMHostNetworkAdapter -VMHost "esxi01.vmeduc.com"|-PortGroup $pg -VirtualSwitch $switch|-IP 10.0.0.2 -SubnetMask 255.255.255.0 Example: |
Mount an NFS datastore (PowerCLI) | New-Datastore $ESXHost = "esxi01.vmeduc.com"||$NFSHost = "nfs01.vmeduc.com"||$NFSMountPoint = "/iso"||New-Datastore -nfs -VMHost $ESXHost -Name NFS_ISOs|-NFSHost $NFSHost -Path $NFSMountPoint -ReadOnly Example: |
List available datastores (PowerCLI) | Get-Datastore Get-Datastore -VMHost "esxi01.vmeduc.com" Example: |
Rename a local datastore, "datastore1" to "LocalDatastore1" (PowerCLI) | Set-Datastore Get-Datastore -VMHost "esxi01.vmeduc.com"|-Name datastore1 ||Set-Datastore -Name "LocalDatastore1" Example: |
Mount a local datastore, "Localdatastore1" as a PowerShell drive (PowerCLI) | New-PSDrive $ds = Get-Datastore "Localdatastore1"||New-PSDrive -Name vmfs|-PSProvider VIMDataStore|-Root '/' -Location $ds Example: |
Remove the PowerShell drive, "vmfs" (PowerCLI) | Remove-PSDrive Remove-PSDrive vmfs Example: |
Configure NTP on an ESX/i host (PowerCLI) | Add-VMHostNtpServer||Restart-VMHostService $ESXHost = "esxi01.vmeduc.com"||Add-VMHostNtpServer -NtpServer "0.pool.ntp.org"|-VMHost $ESXHost -Confirm||$ntp = Get-VMHostService -VMHost $ESXHost ||Where ($_.Key -eq 'ntpd'}||Restart-VMHostService $ntp -Confirm Example: |
Verify the NFP service is running on an ESX/i (PowerCLI) | Get-VMHostService||Get-VMHostNtpServer $ESXHost = "esxi01.vmeduc.com"||Get-VMHostService -VMHost $ESXHost||Get-VMHostNtpServer -VMHost $ESXHost Example: |
Create a host profile (PowerCLI) | New-VMHostProfile $ESXHost = "esxi01.vmeduc.com"||New-VMHostProfile -Name BaseProfile|-ReferenceHost $ESXHost Example: |
Associate a host profile with a particular ESX/i host (PowerCLI) | Apply-VMHostProfile $ESXHost = "esxi01.vmeduc.com"||$profile = Get-VMHostProfile -Name BaseProfile||Get-VMHost $ESXHost | Apply-VMHostProfile|-Profile $profile -AssociateOnly Example: |
Test for host profile compliance (PowerCLI) | Test-VMHostProfileCompliance $ESXHost = "esxi01.vmeduc.com"||Get-VMHost $ESXHost ||Test-VMHostProfileCompliance ||Select -ExpandProperty|IncomplianceElementList Example: |
Create a virtual machine (PowerCLI) | New-VM $ESXHost = "esxi01.vmeduc.com"||New-VM -Name NewTestVM -VMHost $ESXHost|-Datastore LocalDatastore1 Example: |
Get a virtual machine's properties via the PowerCLI | Get-VM Get-VM NewTestVM | Format-List * Example: |
Remove a virtual machine from the vCenter inventory (PowerCLI) | Remove-VM Get-VM NewTestVM | Remove-VM Example: |
Create a custom virtual machine (PowerCLI) | New-VM New-VM -Name NewCustomVM|-VMHost esxi01.vmeduc.com|-Datastore Localdatastore1 -NumCPU 1|-MemoryMB 256 -DiskMB 8192|-DiskStorageFormat Thick|-GuestID winNetEnterpriseGuest Example: |
Install a guest OS into a VM (PowerCLI) | New-CDDrive $ISODatastore = "NFS_ISOs"||$ISOGuestInstaller = "Win2008.iso"||New-CDDrive -VM NewCustomVM|-ISOPath [$NFS_ISOs]$ISOGuestInstaller|-StartConnected||Get-VM NewCustomVM | Start-VM Example: |
Power on a VM (PowerCLI) | Start-VM Get-VM NewTestVM | Start-VM Example: |
Initiate VMTools installation in an installed VM | Mount-Tools (PowerCLI) Get-VM NewTestVM | Mount-Tools Example: |
Power Off a VM gracefully (PowerCLI) | Shutdown-Guest Get-VM NewTestVM | Shutdown-VMGuest Example: |
Clone a virtual machine to a template (PowerCLI) | New-Template Get-VM NewTestVM | New-Template|-Name NewTestTemplate|-Location (Get-DataCenter MyNewDatacenter) Example: |
Create a guest OS customization specification for use in vCenter cloning and template deployment (PowerCLI) | New-OSCustomizationSpec New-OSCustomizationSpec|-Name MyCustomizationSpecification -OSType Windows|-FullName YourName -OrgName YourOrganizationName|-NamingScheme VM|-Product Key "windows-product-key-here"|-LicenseMode PerSeat -AdminPass vmware|-Workgroup MyWorkgroup -ChangeSid Example: |
View a guest OS customization specification used in vCenter cloning and template delopement (PowerCLI) | Get-OSCustomizatizationSpec Get-OSCustomizationSpec Example: |
Deploy a virtual machine from a vCenter template (PowerCLI) | New-VM New-VM -Name VMFromTemplate1|-Template NewTestTemplate|-VMHost esxi01.vmeduc.com|-DataStore LocalDatastore1|-OsCustomizationSpec MyCustomizationSpecification Example: |
Create multiple virtual machines from a CSV file (PowerCLI) | Import-CSV CSV File (C:\VMs.csv) Contents:|name,hostname,template,datastore|vm01,esxi01.vmeduc.com,NewTestTemplate,LocalDatastore1|vm02,esxi01.vmeduc.com,NewTestTemplate,LocalDatastore1||$vmcsv = Import-CSV C:\VMs.csv||foreach ($line) {|New-VM -Name $line.name -VMHost $line.hostname|-Template $line.template -Datastore $line.datastore|-OSCustomizationSpec MyCustomizationSpecification|} Example: |
Add RAM to a virtual machine (PowerCLI) | Set-VM $vm = "MyTestVM"||Get-VM $vm | Shutdown-VMGuest||Get-VM $vm | Set-VM -MemoryMB 512 Example: |
Add a CPU to a virtual machine (PowerCLI) | Set-VM $vm = "MyTestVM"||Get-VM $vm | Shutdown-VMGuest||Get-VM $vm | Set-VM -NumCPU 2 Example: |
Add a hard drive to a virtual machine (PowerCLI) | New-HardDisk $vm = "MyTestVM"||Get-VM $vm | Shutdown-VMGuest||Get-VM $vm | New-HardDisk -CapacityKB 20680 -ThinProvisioned:$true Example: |
Retrieve virtual machine hard drive information (PowerCLI) | Get-HardDisk $vm = "MyTestVM"||Get-VM $vm | Get-HardDisk | Select-Object Name, StorageFormat, CapacityKB Example: |
Copy files (.Net installer in this example) to a virtual machine (PowerCLI) | Copy-VMGuestFile $oVM = Get-VM "MyTestVM"||$ESXCred = Get-Credential||$VMCred = Get-Credential||Copy-VMGuestFile -Source C:\.NetInstallerFile.exe|-Destination C:\ -VM $oVM -LocalToGuest|-HostCredential $ESXCred -GuestCredential $GuestCred Example: |
Run a cmdlet remotely in a virtual machine (PowerCLI) | Invoke-VMScript $vm = MyTestVM||$ESXCred = Get-Credential||$VMCred = Get-Credential||Get-VM $vm |Invoke-VMScript -HostCredential $ESXCred|-GuestCredential $VMCred "Get-Service"||Get-VM $vm |Invoke-VMScript -HostCredential $ESXCred|-GuestCredential $VMCred "Set-Service Alerter|-StartupType Manual"||Get-VM $vm |Invoke-VMScript -HostCredential $ESXCred|-GuestCredential $VMCred "Set-Service Alerter ||Start-Service" Examples: |
Create a snapshot on a virtual machine (PowerCLI) | New-Snapshot $vm = "MyTestVM"||Get-VM $vm | New-Snapshot -Name "Snapshot01" -Memory:$true Example: |
Revert a virtual machine to a snapshot (PowerCLI) | Get-Snapshot||Set-VM $vm = "MyTestVM"||Get-VM $vm | Get-Snapshot -Name "Snapshot01" | Set-VM -VM $vm Example: |
Migrate a virtual machine's disk from local to shared storage (PowerCLI) | Move-VM $vm = "MyTestVM"||Get-VM $vm | Move-VM -Datastore "SharedDataStore" Example: |
Get the name of the datastore a virtual machine's files are on (PowerCLI) | Get-DataStore $vm = "MyTestVM"||Get-VM $vm | Select Name,|{$_ | Get-DataStore} Example: |
Register (i.e. add) an ESX/i host to the vCenter inventory (PowerCLI) | Add-VMHost Add-VMHost "NewESXHost"|-Location (Get-DataCenter "MyNewDataCenter")|-User root -Password vmware -Force:$true Example: |
Migrate a running virtual machine using vMotion [assuming all vMotion requirements are met, both for the ESX/i servers and the virtual machine] (PowerCLI) | Move-VM $vm = "MyTestVM"||Get-VM $vm | Move-VM -Destination "esxi02.vmeduc.com" Example: |
Cold migrate a virtual machine [assuming the virtual machine is powered off] (PowerCLI) | Move-VM $vm = "MyTestVM"||Get-VM $vm | Move-VM -Destination "esxi02.vmeduc.com" Example: |
Verify the ESX/i host a virtual machine is running on (PowerCLI) | Get-VM $vm = "MyTestVM"||Get-VM $vm | Select Name, Host Example: |
Create an HA/DRS cluster (PowerCLI) | New-Cluster New-Cluster "NewCluster01" -HAEnabled|-DRSEnabled|-Location "MyNewDataCenter" Example: |
Remove an HA/DRS cluster (PowerCLI) | Remove-Cluster Remove-Cluster "NewCluster01" Example: |
Move an ESX/i host into a cluster (PowerCLI) | Move-VMHost $ESXHost = "esxi01.vmeduc.com"||Move-VMhost $ESXHost -Destination "NewCluster01" Example: |
View DRS/HA cluster information (PowerCLI) | Get-Cluster Get-Cluster||Get-Cluster "NewCluster01" Examples: |
Change a DRS cluster's automation level | Set-Cluster Set-Cluster "NewCluster01"|-drsAutomationLevel PartiallyAutomated||also FullyAutomated, Manual Example: |
Enable HA admission control on a cluster (PowerCLI) | Set-Cluster Set-Cluster "NewCluster01"|-HAAdmissionControlEnabled:$true Example: |
Determine whether HA admission control is enabled on a cluster (PowerCLI) | Get-Cluster Get-Cluster "NewCluster01" | Select Name, HAAdmissionControlEnabled Example: |
Place an ESX/i server into maintenance mode (PowerCLI) | Set-VMHost Set-VMHost "esxi01.vmeduc.com" -State "Maintenance" Example: |
Bring an ESX/i server out of maintenance mode (PowerCLI) | Set-VMHost Set-VMHost "esxi01.vmeduc.com" -State "Connected" Example: |
Disconnect an ESX/i server from vCenter (PowerCLI) | Set-VMHost Set-VMHost "esxi01.vmeduc.com" -State "Disconnected" Example: |
Suspend a virtual machine (PowerCLI) | Suspend-VM $vm = "MyTestVM"||Suspend-VM -VM $vm Example: |
Resume a suspended virtual machine (PowerCLI) | Start-VM $vm = "MyTestVM"||Start-VM -VM $vm Example: |
Create a resource pool (PowerCLI) | New-ResourcePool New-ResourcePool -Name "TestRP01" -Location "NewCluster01"||New-ResourcePool -Name "TestRP01" -Location "NewCluster01" -CPUSharesLevel High|-MemSharesLevel High Examples: |
Change a resource pool's settings (PowerCLI) | Set-ResourcePool Get-ResourcePool "TestRP01" ||Set-ResourcePool -CPUReservationMHZ 500|-MemReservationMB 256 Example: |
Get selected information about a resource pool's settings (PowerCLI) | Get-ResourcePool Get-ResourcePool "TestRP01" | Select CPUReservationMHZ, MemReservationMB Example: |
Determine what properties can be retrieved about a virtual machine (PowerCLI) | Get-VM||Get-Member Get-VM | Get-Member Example: |
Return select properties of a virtual machine (PowerCLI) | Get-VM||Select Get-VM | Select Name, PowerState, Host Example: |
Retrieve all a virtual machine's properties (PowerCLI) | Get-VM||Format-List Get-VM "MyTestVM" | Format-List Example: |
Retrieve a virtual machine's hostname, screen dimensions and NIC information (PowerCLI) | Get-VMGuest||Select Get-VMGuest "MyTestVM" | Select Hostname, ScreenDimensions, Nics Example: |
Return a list of all a virtual machine's properties and methods (PowerCLI) | Get-VMGuest||Get-Member Get-VMGuest "MyTestVM" | Get-Member Example: |
Find all virtual machines with connected CD-ROMs (PowerCLI) | Get-VM Get-VM | Where {($_.CDDrives)[0].ConnectionState.Connected} Example: |
Disconnect CD-ROM drives from virtual machines (PowerCLI) | Get-CDDrive||Set-CDDrive Get-VM | Get-CDDrive | Set-CDDrive|-Connected:$false Example: |
List a virtual machine's TCP/IP addresses (PowerCLI) | Get-VMGuest Get-VMGuest "MyTestVM" | Select|-ExpandProperty IPAddress Example: |
Generate a list of all virtual machine's names and IP addresses (PowerCLI) | Get-VM Get-VM | Select Name, @{N="IPAddress"; E={$_ | Get-VMGuest | Select -ExpandProperty IP*}} Example: |
List the capacity and free space of a virtual machine's disk(s) (PowerCLI) | Get-VMGuest Get-VMGuest "MyTestVM" ||Select -ExpandProperty Disks Example: |
List the hard disk size for all virtual machines (PowerCLI) | Get-HardDisk Get-VM | Get-HardDisk Example: |
Display for all virtual machines their names and hard disk capacities (PowerCLI) | Get-VM||Get-VMGuest Get-VM | Select Name, @{N="Capacity" ; E={$_ | Get-VMGuest | Select -Expand Disks | Select Capacity}} Example: |
Display for all virtual machines their names and free disk space (PowerCLI) | Get-VM||Get-VMGuest Get-VM | Select Name, @(N="Free" ; E={$_ | Get-VMGuest | Select -Expand Disks | Select FreeSpace}} Example: |
Display for all virtual machines the capacity and free space of their hard drives (PowerCLI) | Get-VM||Get-VMGuest Get-VM | Select Name, @{N="Free" ; E={$_ | Get-VMGuest | Select -Expand Disks | Select FreeSpace}}, @{N="Capacity" ; E={$_ |Get-VMGuest | Select -Expand Disks | Select Capacity}} Example: |
Get the version of VMware Tools installed in a virtual machine (PowerCLI) | Get-VM||Get-View $vm = "MyTestVM"||$vmView = Get-VM $vm | Get-View||$vmView.Config.Tools.ToolsVersion Example: |
Find virtual machines with snapshots (PowerCLI) | Get-Snapshot Get-VM | Get-Snapshot | Select VM, Name Example: |
Get a list of snapshots and when they were created (PowerCLI) | Get-Snapshot Get-VM | Get-Snapshot | Select VM, Name, Created Example: |
Find all snapshots more than 30 days old (PowerCLI) | Get-Snapshot||Get-Date Get-VM | Get-Snapshot | Where {$_.Created|-le (Get-Date).AddDays(-30)} Example: |
Collect one performance sample from each of the major subsystems on a single virtual machine (PowerCLI) | Get-Stat||Format-Table $vm = "MyTestVM"||Get-VM $vm | Get-Stat -MaxSamples 1|-RealTime | Format-Table -AutoSize Example: |
Collect one performance sample from each of the major subsystems on a single virtual machine, outputting the results to an HTML file (PowerCLI) | Get-Stat||Convertto-Html $vm = "MyTestVM"||Get-VM $vm | Get-Stat -MaxSamples 1|-RealTime | Convertto-Html | Out-File "C:\VMResults.html" Example: |
Collect one performance sample from each of the major subsystems on a single virtual machine, outputting the results to Grid View (PowerCLI) | Get-Stat||Out-GridView $vm = "MyTestVM"||Get-VM $vm | Get-Stat -MaxSamples 1|-RealTime | Out-GridView Example: |
Collect one performance sample from each of the major subsystems on a single virtual machine, outputting the results to a CSV file (PowerCLI) | Get-Stat||Export-CSV $vm = "MyTestVM"||Get-VM $vm | Get-Stat -MaxSamples 1|-RealTime | Export-CSV "C:\VMResults.csv" Example: |
Send an email alert (PowerCLI) | Net.Mail.SmtpClient $vm = "MyTestVM"||$Result = Get-VM $vm | Get-Stat -MaxSamples 1|-RealTime||$emailFrom = "Your-Email-Address"||$emailTo = "Destination-Email-Address"||$subject = "Performance Results"||$smtpServer = "smtp.some.domain"||$smtp = New-Object Net.Mail.SmtpClient ($smtpServer)||$smtp.send ($emailFrom, $emailTo, $subject, $Result) Example: |
Get the properties and methods of an ESX/i server (PowerCLI) | Get-VMHost||Get-Method Get-VMHost | Get-Method Example: |
Get the host name, manufacturer, model and processor type of your ESX/i hosts (PowerCLI) | Get-VMHost Get-VMHost | Select Name, Manufacturer, Model, ProcessorType Example: |
Get the host name, ESX version and ESX build number (PowerCLI) | Get-VMHost Get-VMHost | Select Name, Version, Build Example: |
Display all ESX/i hardware details (PowerCLI) | Get-VMHost $ESXHost = "esxi01.vmeduc.com"||Get-VMHost $ESXHost | Get-View ||Foreach-Object {$_.Summary.Hardware) Example: |
Display all datastores on an ESX/i host (PowerCLI) | Get-DataStore Get-VMHost "esx01.vmeduc.com" ||Get-DataStore Example: |
List datastores which are not accessible (PowerCLI) | Get-DataStore Get-DataStore | Where {-not $_.Accessible} Example: |
List all SCSI LUNs on an ESX/i host (PowerCLI) | Get-ScsiLUN Get-VMHost "esxi01.vmeduc.com" ||Get-ScsiLUN Example: |
List all SCSI LUN paths on an ESX/i host (PowerCLI) | Get-ScsiLUN||Get-ScsiLUNPath Get-VMHost "esxi01.vmeduc.com" ||Get-ScsiLUN | Get-ScsiLUNPath Example: |
Display host volumes and their filesystem types (PowerCLI) | Get-VMHostStorage Get-VMHost "esxi01.vmeduc.com" ||Get-VMHostStorage | Select -ExpandProperty FilesystemVolumeInfo Example: |
List virtual switch port groups (PowerCLI) | Get-VirtualSwitch||Get-VirtualPortGroup Get-VMHost "esxi01.vmeduc.com" ||Get-VirtualSwitch | Get-VirtualPortGroups Example: |
List all virtual machines and their connected virtual networks (PowerCLI) | Get-NetworkAdapter Get-VM | Get-NetworkAdapter Example: |
Display switch port usage on all virtual switches (PowerCLI) | Get-VirtualSwitch||Measure-Object Get-VirtualSwitch -VMHost "esxi01.vmeduc.com" | Measure-Object -Sum NumPorts* Example: |
Display the inventory of a DRS/HA cluster (PowerCLI) | Get-Cluster||Get-Inventory Get-Cluster | Get-Inventory Example: |
Determine if admission control is enabled in an HA cluster (PowerCLI) | Get-Cluster Get-Cluster | Where {$_.HAAdmissionControlEnabled} Example: |
Display the DRS scheduler mode and the HA failover level of a DRS/HA cluster (PowerCLI) | Get-Cluster Get-Cluster | Select Name, DRSMode, HAFailoverLevel Example: |
List all resource pools (PowerCLI) | Get-ResourcePool Get-ResourcePool Example: |
Display all virtual machines in a resource pool (PowerCLI) | Get-ResourcePool||Get-Inventory Get-ResourcePool "TestRP01" ||Get-Inventory Example: |
Show a resource pool's name, memory limit, memory reservation and memory shares (PowerCLI) | Get-ResourcePool Get-ResourcePool "TestRP01" | Select Name, MemLimitMB, MemReservationLevel, MemSharesLevel Example: |
Show a resource pool's CPU expandability, CPU limit, CPU shares and CPU reservation (PowerCLI) | Get-ResourcePool Get-ResourcePool "TestRP01" | Select Name, CPUExpandableReservations, CPULimitMHz, CPUReservationsMHz, CPUSharesLevel Example: |
Display all the properties and methods of a resource pool (PowerCLI) | Get-ResourcePool||Format-List Get-ResourcePool "TestRP01" ||Format-List * Example: |