Hi,
I am trying to export multiple lines notes from VM, using the below, I am able to get only first line, please help
Get-VM | Select Name,Notes | Export-Csv -Path ".\VMNotes0.csv" -NoTypeInformation
The problem is with Export-Csv, which can't handle this correctly.
One way to solve is to, for example, replace the NewLine with a blank
Select Name, @{N='Notes';E={$_.Notes.replace("`n",' ')}} |
Export-Csv -Path ".\VMNotes0.csv" -NoTypeInformation
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The problem is with Export-Csv, which can't handle this correctly.
One way to solve is to, for example, replace the NewLine with a blank
Select Name, @{N='Notes';E={$_.Notes.replace("`n",' ')}} |
Export-Csv -Path ".\VMNotes0.csv" -NoTypeInformation
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Got it LucD, that worked
The below will list the Powered Off VMs with Notes
Get-VM | where {$_.powerstate -match "off"} | Select Name, @{N='Notes';E={$_.Notes.replace("`n",' ')}} | FT -autosize