PowerCLI
Get-VMHostNetworkAdapter | select VMhost, Name, IP, SubnetMask, Mac, PortGroupName, vMotionEnabled, mtu, FullDuplex, BitRatePerSec | Export-Csv C:\VMHostNetworkDetails.csv
Get-VM | Select Name,@{N='IP';E={[string]::Join(',',$_.Guest.IPAddress)}}
get-vm | select Name,@{N="IP Address";E={@($_.guest.IPAddress[0])}} | out-file c:\VM_IP_Addresses.csv
Get-VM | Export-Csv C:\VMHostNetworkDetails.csv
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -NoExit -Command C:\first.ps1
Get-VM | Export-Csv -path “c:\reports\vminventory.csv”
Get-VM | select Name, Description, PowerState, NumCpu, MemoryGB | Export-Csv -path “c:\reports\vminventory.csv”
Get-VM | Select Name,@{N='IP';E={[string]::Join(',',$_.Guest.IPAddress)}}
get-vm | select Name,@{N="IP Address";E={@($_.guest.IPAddress[0])}} | out-file c:\VM_IP_Addresses.csv
get
-vm
| get
-view
|
where
{$_.Guest.GuestFullName
-like
"*Windows*"
} |
select
Name,@{N=
"OS"
;E={@($_.Guest.GuestFullName)}},@{N=
"IP"
;E={@($_.Guest.IPAddress)}} |
export-csv
-notypeinformation
$env
:userprofile\desktop\export.csv
Get-ViPermission –Entity *inventory object*
Get-VM
"AnyVM"
|
Get-View
|
Get-Member
For instance, it's trivial to grab all the vms with
get-vm
and list their IPs:get-vm | select Name,@{name="IP addresses";expression={$_.guest.IPAddress}}
get-vm -location MyResourcePool | select Name,@{name="IP addresses";expression={$_.guest.IPAddress}}
Get-ViPermission –Entity *inventory object*
Get-VMHost | Get-VMHostNetwork | Select Hostname, VMkernelGateway -ExpandProperty VirtualNic | Where {$_.VMotionEnabled} | Select Hostname, PortGroupName, IP, SubnetMask, VMkernelGateway, Devicename
Get-VMHost | Get-VMHostNetwork | Select Hostname, ConsoleGateway, DNSAddress -ExpandProperty ConsoleNic | Select Hostname, PortGroupName, IP, SubnetMask, ConsoleGateway, DNSAddress, Devicename
Comments
Post a Comment