Have a look in the vmware.log that belongs to the problematic VMs.
Cant see anything strange in the logfile.
However.. a clue.
If i first login to the server with RDP (same creds) and then execute the invoke-vmscript i get output and it works.
If i then logout from RDP session, no output from Invoke-VMScript when trying again
That looks as if it might be a Windows profile issue.
When there is no profile for the user, it will not be created when logging on implicitly through Invoke-VMScript.
Can you run a simple command in DOS?Invoke-VMScript -VM $vm -ScriptType Bat -ScriptText 'dir' -GuestCredential $cred
Thats true, when were using BAT as scripttype it´s working.
That looks as if the PowerShell script hangs because it is looking for your PowerShell profile file.
The solution is to use the NoProfile parameter on the powershell.exe command (launch as BAT).
Try if this works.$vm = Get-VM YourVM
$cmd = @'
powershell -NonInteractive -NoProfile -Command "Get-Process"
Invoke-VMScript -VM $vm -ScriptText $cmd -ScriptType Bat