I’ve got a script that runs reports against a vCenter server. It will tell me whether the VM exists or not. Everything works great except for the error var. I’m trying to output the $error I have below into a CSV file so that it’s easy to remove the characters before and after the single quotation marks. In the example below ‘testing’ is the VM that I can’t run a report against since it doesn’t exist in vCenter. I’m running this command to generate the output but I’d like it cleaned up a bit.
$error | Group-Object | Format-Table Name -AutoSize | Out-String
Here is the output:
7/23/2020 2:10:42 PM Get-VM VM with name ‘testing’ was not found using the …
The date and time will change in each row that gets populated in the CSV file as the report is generated against the VM’s.
Any ideas would be appreciated!