In order to be able to help troubleshooting an issue when invoking cmdlets in PowerCLI, you can collect debugging information by invoking the ‘Get-ErrorReport’ cmdlet to reproduce the problem and generate relevant information to a compressed file.
In order to reproduce the problem, the cmdlet runs the script block which is required to passed to the ‘ProblemScript’ parameter, in this example we will establish a connection to the vCenter Server System and assume that invoking the cmdlet ‘Get-VM’ is generating an issue.
$Script = { Connect-VIServer vcenter.domain.local Get-VM}
Now that we have created the script text to which is generating an issue we need to invoke the ‘Get-ErrorReport’ cmdlet to generate the debugging information.
Get-ErrorReport -ProblemScriptTimeoutSeconds 60 -ProblemDescription "Get-VM is not returning data" -Destination 'D:\Output' -ProblemScript $Script
In the above example, we will be running the script to reproduce the issue, specifying a time period to wait until considering the problem script is not responding, creating a description of the problem and a destination to collect the debugging information as a compressed file, which will be generated with the naming convention ‘VMware-PowerCLI-Support-dd-MMM-yyyy HH-mm-ss.zip’.
Now we can troubleshoot the issue further than the console output or provide the debugging information to PowerCLI support.