Execution of the new-vm cmdlet via PowerCLI within VSCode results in the following console error: "operation is not valid due to the current state of the object".
Despite this error in the client, the corresponding virtual machine creation task completes successfully within the vCenter Server Recent Tasks. Executing the PowerCLI debug command get-errorreport yields no explicit failure data or root cause indicators.
vCenter Server 8.0
VMware PowerCLI 9.0
A stale or corrupted cache/state within the active PowerShell session or VSCode environment causes the PowerCLI cmdlet to return a false failure state locally.
Terminate the active VSCode application and all associated PowerShell sessions.
Launch a new instance of VSCode to initialize a fresh PowerShell session.
Re-authenticate to the vCenter Server using the Connect-VIServer cmdlet.
Execute the required new-vm PowerCLI cmdlets within the clean runtime environment.