hi
i am new in VMware powerCLI scripting , i am looking for script that find all VM's that running with Static IP addess.
is it possible ?
thanks
Have a look at 1. Re: Getting guest IP address
Or did you mean, guests that are configured to have a static IP vs a DHCP assigned IP ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks you for your quick reply. Yes i meant to guests that are configured as static IP vs a DHCP assigned IP .
From PowerShell v4 onwards you can do the following
Get-NetAdapter |
Select Name,
InterfaceIndex,
@{N='DHCP';E={Get-NetIPInterface -InterfaceIndex $_.InterfaceIndex | Select -ExpandProperty DHCP}}
Note that this needs to run inside the guest OS (via Invoke-VMScript or with a remote PowerShell session)
If you're not on PowerShell v4 yet, you can achieve the same via the WMI classes.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference