VMware Cloud Community
LewisLanware
Contributor
Contributor

Invoke-VMScript: The operation is not allowed in the current state.

Hi guys.

I'm trying to run a command, any command, via Invoke-VMScript to a guest VM and getting the error in the title.

My connection is going as follows:
PC --(connect-viserver)--> VC01 --(invoke-vmscript)--> Guest

I can see in both the VM's vcenter logs, and in event viewer that the command is reaching the guest and if I run invoke-vmscript directly from the vcenter, it works and I get the expected output.

0 Kudos
5 Replies
LucD
Leadership
Leadership

Stupid suggestion perhaps, but did you already stop/start your PS/PowerCLI session on the PC?

Sometimes the above general message also comes when a session is corrupted.

Another thing to check, is the FW on your PC perhaps blocking port 902?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
LewisLanware
Contributor
Contributor

Alright, we are closer I think.

I have opened TCP 902 through our firewall and the error has changed to "An error occurred while sending the request".

0 Kudos
LucD
Leadership
Leadership

Can you disable the FW on your PC completely while doing the test?
Just to make sure there are no other ports causing issues.

Can the vCenter and ESXi nodes be DNS resolved (forward and reverse) on the PC?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
LewisLanware
Contributor
Contributor

There's no OS level firewall, only network level.

Both the PC and vCenter/ESXi host can resolve each other.

0 Kudos
LucD
Leadership
Leadership

Could there be a TLS issue?

See KB2137109


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos