I'm having an issue with following piece of code:
$NodeList = (get-scvmhostcluster ClusterName| where-object {$_.nodes.fullyqualifieddomainname -ne "Host001.Domain.Tld"}).nodes.fullyqualifieddomainname
Normally this should filter from the list of Hosts the "Host001.Domain.tld" out of the list. (Host001 up to Host014 is what this list normally generates, unfiltered).
However, when running the script block and seeing whats in the $NodeList variable I get every single object as if the filter was not applied.
I've been trying to debug this for a few hours now but to no avail.
Anyone able to point out my wrongdoings ?
Regards,
get-scvmhostcluster ClusterName| foreach-object {$_.nodes.fullyqualifieddomainname}do you get any values?fullyqualifieddomainnamea string? if you put a breakpoint at the where-object block, and check$_.nodes.fullyqualifieddomainname.GetType()what do you get?where-object {$_.nodes.fullyqualifieddomainname -notlike "*Host001.Domain.Tld*"}