VMware Cloud Community
Raf0406
Contributor
Contributor
Jump to solution

Export all Notes from a VM in one line

Hello guys,

Can you please help me doing this :

I need to export some VM information to be able to populate the CMDB automatically.

One of those are the VM notes.

This command work : get-vm "myvm" | select-object @{N="VMNotes";E={$_.Notes}}

The problem is : When I have multiple notes on multiple lines for a VM, the export-CSV report only the first one.

Example :

VMname : TEST

Notes :

- Notes1

- Notes2

The export will look like

? Notes1

Can you help me getting rid of the "?" and have everything exported correctly ? like Notes1 Notes2 in the same cell

Thx

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-VM -Name MyVM |

Select-Object Name,@{N='Notes';E={$_.Notes.Replace("`n",'/')}} |

Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-VM -Name MyVM |

Select-Object Name,@{N='Notes';E={$_.Notes.Replace("`n",'/')}} |

Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Raf0406
Contributor
Contributor
Jump to solution

Thx Luc, work as expected.

Have a nice day

Raf

0 Kudos