Hello,
I have the below script running, however when ever I'm trying to add the nodes field it's not working.
Get-VM | Sort-Object -property Name | Get-View -Property @("Name", "Guest.GuestFullName", "Guest.IPAddress", "VM.Notes") | Select -Property Name, @{N="Running-OS";E={$_.Guest.GuestFullName}},@{N="ip",E={$_.Guest.IPAddress -join '|'}}N,"notes descrp";E={$_.Guest.VM.Notes}} | Export-Csv -Path c:\temp\report.csv
When I'm adding notes I'm getting error.
Can some one help me on this.
'VM.Notes ' - is not a valid property do you have that information stored in an 'annotation' ?
Since you are using Get-View, the calculated property should be
@{N='notes descrp';E={$_.Config.Annotation}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
get-view is much faster than get-vm, there is not necessary to use get-vm
Correct, You can run this without Get-VM:
Get-View -ViewType VirtualMachine | Select-Object -Property Name, @{N="Running-OS";E={$_.Guest.GuestFullName}},@{N="ip";E={$_.Guest.IPAddress}},@{N="notes Desc";E={$_.Config.Annotation}} | Export-Csv -Path c:\temp\report.csv
Not sure what you were trying to accomplish with the '-join'