snktech
Enthusiast
Enthusiast

OK... solved it!

Started just printing everything I could for debugging and saw there was no HOME var (linux var, not powershell). Apparently if PowerCLI doesn't have a HOME environment variable set, it won't work no matter where you put the modules. Added the following to the script that calls the ps1, problem solved (obviously if using a different service account would need to change accordingly).

 

 

 

export HOME=/root

 

 

 

I assume it's due to PowerCli storing its settings in ~/.local/share/VMware/PowerCLI  and not able to pick them up without a HOME var.

 

Edit: just a suggestion if anyone wants it, but if practical I'd very much recommend moving to a "check if config exists in ~ if not use the default from /etc" or similar way of doing things.

View solution in original post