I am trying to create a vcenter user by using the dir-cli command and Invoke-Script module. The command works in some vCenters and in some of the vCenters it gives the following error:
How exactly are you running those command using PowerShell?
Could you show us the script itself and the execution of it?
What if you try to run the InvokeVMScript portion of code manually without getting the credentials, does it work?
Also i can see on the code on the $cmd that you are using ' and " between $createscript and i guess there is a misstypo as one closes before the other one open (Maybe i am wrong)
Moderator: Thread moved to the PowerCLI area.
The same script works with other vCenters. I am facing this issue in one vCenter only.
Oh good to know then, let's focus in the error then.
What is the status of the vmafdd service inside vCenter Server? Or inside the Platform Services Controller if you have an External Topology.
Maybe that is your issue thinking out loud. You are running the script inside the vCenter Server VM but it does not have that service because you have an external topology. If this is not the case please check the status of the serivces mentioned above.
The service is running. Anything else to check?