Here is a page of One liners I have written/collected over the years. I will add more over time.
Get-VMHost | Get-VMHostNetwork | Select Hostname, VMKernelGateway -ExpandProperty VirtualNic | Select Hostname, PortGroupName, IP, MTU
# Lists eachs hosts VMKernal interfaces with there PortGroup, IP and MTU.
Get-VMhost | Get-SCSILun | Where {$_.Vendor –match “NETAPP”} | Set-SCSILun –MultipathPolicy “RoundRobin”
# Set all NetApp LUNs to RoundRobin
Get-VMHost | Sort Name | Select Name, @{N=”NTPServer”;E={Get-VMHostNtpServer $_}}
# get all hosts NTP servers.
-vmhost | Get-VMHostAdvancedConfiguration -Name scratch*
# Get current and configured scratch location.
Get-VMHost | Get-VMHostNetwork | Select Hostname, VMKernelGateway -ExpandProperty VirtualNic | Where {$_.vMotionEnabled} | Select Hostname, PortGroupName, IP, SubnetMask
# get PortGroup, IP and subnet of all hosts.?
Get-VMHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } | select VMHost, Label, Running
# Select SSH service running status on each host.
Get-VM | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
# remove ISO images from all VMs.
Get-VM | Get-Snapshot | Select VM, Name, Description, Created, SizeMb
# List all snapshots, listing VM name, snapshot name, discription and created time.
Get-VM | Get-Snapshot | Select VM, Name, Created, sizemb | Where {$_.Created -lt ((Get-Date).AddDays(-2))}
# List all snapshots older then 2 days
get-vm | Get-NetworkAdapter | Format-Table parent, networkname, type, MACaddress
# get VM name, PortGroup, NIC type and MAC address
Get-VM | Get-HardDisk | ft Parent, Name, CapacityGB –AutoSize
# get VM name, HD name and size.
Get-Log hostd -VMHost (Get-VMHost "HostToGetLog") | Select -Expand Entries | Select-String warning
# Get lines from the Hostd log fro host “HostToGetLog” containing “Warning”
Logtype hostd -VMHost (Get-VMHost "HostToGetLog")
# list server logs (normally hostd, vmkernal, epxa)
get-VM | Get-VIEvent -Start (get-date).adddays(-3) | Where {$_.fullFormattedMessage -like "*Power*"}
# List all VM power events for the last 3 days