VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Export and Import VM Multi line notes

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

Get-VM |

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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

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

Get-VM |

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

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Got it LucD, that worked Smiley Happy

0 Kudos
NAV4UK
Contributor
Contributor
Jump to solution

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

pastedImage_4.png

0 Kudos