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
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
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
Thx Luc, work as expected.
Have a nice day
Raf