PowerShell script exchange
Post Reply
ThierryF
Expert
Posts: 129
Liked: 33 times
Joined: Mar 31, 2018 10:20 am
Contact:

GetIpv4Addresses() not returning all node IP Addr... ?

Post by ThierryF »

Hello,

Is it normal GetIpv4Addresses() not to return all node IP Addresses ?
According function name, it should return all ipv4 AddressES ... :roll:

The following powershell script does highlight the issue :

Code: Select all

foreach ($VM in Find-VBRViEntity | Where-Object {$_.Type -eq "Vm"}  | sort-object -property name ) {
$VMNAME=$VM.Name;
$IPADDR="";
foreach ($TMPIP in $VM.GuestInfo.GetIpv4Addresses()) {
$IP=$TMPIP.IPAddressToString
$IPADDR="$IPADDR $IP -"
}
write-host "`n ",$VMNAME," -> ", $IPADDR;
}
Thanks !

TH
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: GetIpv4Addresses() not returning all node IP Addr... ?

Post by veremin »

You're using the internal (non-public) PowerShell method, so, execution results might be misleading.

If you want to get information regarding guest VM configuration, including IP addresses, leverage PowerCLI.

Thanks.
ThierryF
Expert
Posts: 129
Liked: 33 times
Joined: Mar 31, 2018 10:20 am
Contact:

Re: GetIpv4Addresses() not returning all node IP Addr... ?

Post by ThierryF »

No, just using veeam powershell. I also frequently use Find-VBRViDatastorecluster and Find-VBRViDatastore.
Yes, I could also use PowerCli but I am from the veeam side of the vm... and, btw, it is not non-public,
I found trick from this forum. And you should not be an powershell expert for retrieving
function GetIpv4AddressES from $VM.GuestInfo ...

Should I also prefer looking at console rather than powershell for grabing consistent info ?
Do you mean Misleading to be simpler anagram of bug ? ;-)

Anyway, thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: GetIpv4Addresses() not returning all node IP Addr... ?

Post by veremin »

it is not non-public, I found trick from this forum. And you should not be an powershell expert for retrieving function GetIpv4AddressES from $VM.GuestInfo ...
The method operates directly with configuration database, it's created for specific product needs, it's not covered in PowerShell User Guide, etc. - so, yes it is internal regardless of where you've found it. Because of that, it might provide results different from the ones you expect.
Should I also prefer looking at console rather than powershell for grabing consistent info ?
Console does not expose information regarding Guest OS IP.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 16 guests