VMware Cloud Community
Arkady
Contributor
Contributor
Jump to solution

Running powershell scripts under different account

Hello,

I use a dedicated VM with Powershell/PowerGUI installed under my account, and was able to execute all scripts successfully.

When another user logs in to this VM (user has all proper permissions in vSphere) scripts fail with errors complaining that none of cmdlet are recognized.

Appreciate any suggestions.

Thanks in advance.

Arkady

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Oh my, that's a very old version.

PowerCLI is now all modules.

See Welcome PowerCLI to the PowerShell Gallery – Install Process Updates on how to upgrade.

Also have a look at the PowerSHell version you are using.
You can check with displaying the contents of $PSVersionTable.

Try to upgrade that one as well, if possible. Most of us are using the 5.1 version.


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

View solution in original post

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

That depends a bit on the versions of PowerShell and PowerCLI you are using.

But the main reason could be that the PowerCLI modules were installed in the scope CurrentUser.

In that case another account will not find the modules.

Check with

Get-Module -Name VMware* -ListAvailable

And verify which Directory is mentioned above the PowerCLI modules.
If that is a folder under your user, the installation was done in the CurrentUser scope.

Remove the modules, and from a PS session started as Administrator, run

Install-Module -Name VMware.PowerCLI -Scope AllUsers

PS:not sure why you are still using PowerGUI?
That is an outdated product, that is not maintained anymore, and doesn't even have support for the latest PowerShell versions.

Have a look at Visual Studio Code with the PowerShell extension.


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

Reply
0 Kudos
Arkady
Contributor
Contributor
Jump to solution

Hello Luc,

This command Get-Module -Name VMware* -ListAvailable does not give back any output

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Are you running an older PowerCLI version?
Do a Get-PowerCLIVersion


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

Reply
0 Kudos
Arkady
Contributor
Contributor
Jump to solution

PowerCLI Version

----------------

   VMware vSphere PowerCLI 5.5 Release 1 build 1295336

---------------

Snapin Versions

---------------

   VMWare AutoDeploy PowerCLI Component 5.5 build 1262826

   VMWare ImageBuilder PowerCLI Component 5.5 build 1262826

   VMware License PowerCLI Component 5.5 build 1265954

   VMware VDS PowerCLI Component 5.5 build 1295334

   VMware vSphere PowerCLI Component 5.5 build 1295334

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Oh my, that's a very old version.

PowerCLI is now all modules.

See Welcome PowerCLI to the PowerShell Gallery – Install Process Updates on how to upgrade.

Also have a look at the PowerSHell version you are using.
You can check with displaying the contents of $PSVersionTable.

Try to upgrade that one as well, if possible. Most of us are using the 5.1 version.


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

Reply
0 Kudos
Arkady
Contributor
Contributor
Jump to solution

I have Powershell version 2.0.

Have to upgrade all components. Thank you Luc!

Reply
0 Kudos