Print
Hits: 2930

Useful PowerCLI one-liners.

# Get group of hosts by Name

$VMhosts = Get-VMHost | Where Name -Like '*esxpbc*'

# List specific vmkernel IP.  Can use IP or NAME to filter.

$VMhosts | Get-VMHostNetworkAdapter | where IP -Like '10.4.45*'

# List all Host vMotion network ip and vmkernel gateway.

Get-VMHost | Get-VMHostNetwork | Select Hostname, VMkernelGateway -ExpandProperty VirtualNic | Where {$_.VMotionEnabled} | Select Hostname, PortGroupName, IP, SubnetMask, VMkernelGateway, Devicename | FT

# List users with "Admin" permissions on vCenter.

Get-VIPermission | Where {$_.Role –eq “Admin”} | Select Role, Principal, Entity, UID | Export-CSV “C:\Temp\Rights.csv”

# List all user permissions on vCenter.

Get-VIPermission | Select Role, Principal, Entity, UID | Export-Csv "C:\Temp\perms.csv"