PowerCLI

 View Only
  • 1.  Running powershell scripts under different account

    Posted Sep 12, 2018 06:26 PM

    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



  • 2.  RE: Running powershell scripts under different account

    Posted Sep 12, 2018 06:33 PM

    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.



  • 3.  RE: Running powershell scripts under different account

    Posted Sep 12, 2018 07:03 PM

    Hello Luc,

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



  • 4.  RE: Running powershell scripts under different account

    Posted Sep 12, 2018 07:11 PM

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



  • 5.  RE: Running powershell scripts under different account

    Posted Sep 13, 2018 01:42 PM

    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



  • 6.  RE: Running powershell scripts under different account
    Best Answer

    Posted Sep 13, 2018 02:31 PM

    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.



  • 7.  RE: Running powershell scripts under different account

    Posted Sep 13, 2018 02:55 PM

    I have Powershell version 2.0.

    Have to upgrade all components. Thank you Luc!