My script runs the fine below....
Get-InventoryPlus | where {$_.Type -eq 'VirtualMachine'} |
ForEach-Object -Process {
Add-Member -InputObject $_ -MemberType NoteProperty -Name Datastore -Value ((Get-Datastore -VM $_.Name).Name -join '|')
Add-Member -InputObject $_ -MemberType NoteProperty -Name Network -Value ((Get-VirtualPortGroup -VM $_.Name).Name -join '|') -PassThru
} |
Export-Csv C:\Temp\VM-Stuff.txt
A sample of the output...
"Guest Introspection (214)","VirtualMachine","/MIB/ESX Agents/Guest Introspection (214)","/MIB/lab_wan1/ESX Agents/Guest Introspection (214)","vmware-nsx-nfs01","dv-vm-nsx-guestinfra-174-3486|vmservice-vshield-pg"
I get that data for every VM in the datacenter.
Now I want to filter for only VM's where the datastore results contains/has the string value "-nsx-" in it?
Thanks