1 2 3 Previous Next 31 Replies Latest reply on Jun 14, 2019 12:23 PM by LucD

    Having trouble installing Power Cli

    vmk2014 Hot Shot

      Hi Everyone,

      ,

      I have successfully imported module for power cli but while checking power cli version it throws an error

       

      PS C:\Users\admin> Get-PowerCLIVersion

      Get-PowerCLIVersion : The 'Get-PowerCLIVersion' command was found in the module 'VMware.VimAutomation.Core', but the

      module could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.

      At line:1 char:1

      + Get-PowerCLIVersion

      + ~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : ObjectNotFound: (Get-PowerCLIVersion:String) [], CommandNotFoundException

          + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

       

       

       

       

       

      PS C:\Users\admin> Connect-VIServer -Server 160.x.x.10 -Protocol https _user bu\rjk

      Connect-VIServer : The 'Connect-VIServer' command was found in the module 'VMware.VimAutomat

      could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.

      At line:1 char:1

      + Connect-VIServer -Server 160.x.x.10 -Protocol https _user bu\rjk ...

      + ~~~~~~~~~~~~~~~~

          + CategoryInfo          : ObjectNotFound: (Connect-VIServer:String) [], CommandNotFoundE

          + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

       

      thanks

      vmk

        • 1. Re: Having trouble installing Power Cli
          peetz Master
          User ModeratorsvExpert

          Have you tried running 'Import-Module VMware.VimAutomation.Core' ?

          I guess this will also throw an error, but which one?

          • 2. Re: Having trouble installing Power Cli
            vmk2014 Hot Shot

            Yes, i tried and it throws an error.

            • 3. Re: Having trouble installing Power Cli
              LucD Guru
              Community WarriorsvExpertUser Moderators

              It looks as if your PowerCLI installation is not correct, you might have a mix of versions installed.

              Can you run

               

              $PSVersionTable

              $env:PSModulePath.Split(';')

              Get-Module -Name VMware* -ListAvailable | Select Name,Version,ModuleBase

              Get-PSSnapin -Name VMware* -Registered

              Get-WmiObject -Class Win32_Product -Filter "name like '%PowerCLI%'" | Select Name,Version

               

              • 4. Re: Having trouble installing Power Cli
                vmk2014 Hot Shot

                Hi LucD,

                Please find the output. Before that i would to say in order to fix previous error, i did uninstalled power cli forcefully multiple times and even deleted VMware power cli folder from C drive but not resolved

                 

                PS C:\temp> .\test.ps1

                 

                 

                Name                           Value

                ----                           -----

                PSVersion                      5.1.14393.2608

                PSEdition                      Desktop

                PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

                BuildVersion                   10.0.14393.2608

                CLRVersion                     4.0.30319.42000

                WSManStackVersion              3.0

                PSRemotingProtocolVersion      2.3

                SerializationVersion           1.1.0.1

                C:\Users\adminmnt\Documents\WindowsPowerShell\Modules

                C:\Program Files\WindowsPowerShell\Modules

                C:\Windows\system32\WindowsPowerShell\v1.0\Modules

                C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell\

                C:\Program Files\Microsoft Monitoring Agent\Agent\AzureAutomation\7.3.396.0

                 

                 

                Name       : VMware.Vim

                Version    : 6.7.0.10334489

                ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.Vim\6.7.0.10334489

                 

                 

                 

                 

                Name       : VMware.VimAutomation.Cis.Core

                Version    : 11.0.0.10335701

                ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Cis.Core\11.0.0.10335701

                 

                 

                 

                 

                Name       : VMware.VimAutomation.Common

                Version    : 11.0.0.10334497

                ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\11.0.0.10334497

                 

                 

                 

                 

                Name       : VMware.VimAutomation.Sdk

                Version    : 11.0.0.10334495

                ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\11.0.0.10334495

                 

                 

                Get-PSSnapin : No Windows PowerShell snap-ins matching the pattern 'VMware*' were found. Check the pattern and then

                try the command again.

                At C:\temp\test.ps1:7 char:1

                + Get-PSSnapin -Name VMware* -Registered

                + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                    + CategoryInfo          : InvalidArgument: (VMware*:String) [Get-PSSnapin], PSArgumentException

                    + FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.GetPSSnapinCommand

                • 5. Re: Having trouble installing Power Cli
                  LucD Guru
                  User ModeratorsvExpertCommunity Warriors

                  That all looks ok.
                  One more thing, did you also delete the folder C:\Program Files (x86)\VMware\Infrastructure\, if it should still be there?

                  Next step, can you run the following?

                   

                  Import-Module -Name VMware.PowerCLI -Verbose

                  Get-Module -Name VMware*

                   

                  Something else you could try, provided you have access to a local administrator account on your station.

                  Remove the current PowerCLI installation, and then install PowerCLI with the AllUsers scope.

                   

                  Install-Module -Name VMware.PowerCLI -Scope AllUsers -Confirm:$false

                   

                  • 6. Re: Having trouble installing Power Cli
                    vmk2014 Hot Shot

                    LucD,

                     

                    I did follow the steps and even did the clean un-installation but always throws an error after installation

                     

                     

                     

                     

                    PS C:\temp> Get-Module VMware.PowerCLI -ListAvailable | Uninstall-Module -Force

                    PS C:\temp> Get-Module -ListAvailable -Name VMware.* | where {$_.Version -like “11.0.0.*”} | Uninstall-Module -Force

                    PS C:\temp> Get-Module -ListAvailable -Name VMware.*

                     

                     

                     

                     

                        Directory: C:\Users\admin\Documents\WindowsPowerShell\Modules

                     

                     

                     

                     

                    ModuleType Version    Name                                ExportedCommands

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

                    Script     6.7.0.1... VMware.Vim

                     

                     

                     

                     

                    PS C:\temp> Get-Module -ListAvailable -Name VMware.* | where {$_.Version -like “6.7.0.*”} | Uninstall-Module -Force

                    PS C:\temp> Get-Module -ListAvailable -Name VMware.*

                    PS C:\temp> Get-Module VMware* -ListAvailable

                    PS C:\temp> Find-Module -Name VMware.PowerCLI

                     

                     

                    Version    Name                                Repository           Description

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

                    11.0.0.... VMware.PowerCLI                     PSGallery            This Windows PowerShell module contains VMware.P...

                     

                     

                     

                     

                    PS C:\temp> Install-Module -Name VMware.PowerCLI -Scope AllUsers -Confirm:$false

                     

                     

                    Untrusted repository

                    You are installing the modules from an untrusted repository. If you trust this repository, change its

                    InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from

                    'PSGallery'?

                    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A

                    PackageManagement\Install-Package : A command with name 'Export-VM' is already available on this system. This module

                    'VMware.VimAutomation.Core' may override the existing commands. If you still want to install this module

                    'VMware.VimAutomation.Core', use -AllowClobber parameter.

                    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21

                    + ...          $null = PackageManagement\Install-Package @PSBoundParameters

                    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                        + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],

                       Exception

                        + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.Pack

                       ageManagement.Cmdlets.InstallPackage

                    • 7. Re: Having trouble installing Power Cli
                      vmk2014 Hot Shot

                      After installation it shows output

                       

                      PS C:\temp> Get-Module VMware* -ListAvailable

                       

                       

                       

                       

                          Directory: C:\Program Files\WindowsPowerShell\Modules

                       

                       

                       

                       

                      ModuleType Version    Name                                ExportedCommands

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

                      Script     6.7.0.1... VMware.Vim

                      Script     11.0.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer, Disconnect-CisServer, Get-CisService}

                      Script     11.0.0.... VMware.VimAutomation.Common

                      Script     11.0.0.... VMware.VimAutomation.Sdk

                       

                       

                       

                       

                      PS C:\temp> Get-PowerCLIVersion

                      Get-PowerCLIVersion : The term 'Get-PowerCLIVersion' is not recognized as the name of a cmdlet, function, script file,

                      or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and

                      try again.

                      At line:1 char:1

                      + Get-PowerCLIVersion

                      + ~~~~~~~~~~~~~~~~~~~

                          + CategoryInfo          : ObjectNotFound: (Get-PowerCLIVersion:String) [], CommandNotFoundException

                          + FullyQualifiedErrorId : CommandNotFoundException

                       

                       

                      PS C:\temp>

                      • 8. Re: Having trouble installing Power Cli
                        LucD Guru
                        Community WarriorsvExpertUser Moderators

                        You shouldn't test on the module version for the uninstall.

                        PowerCLI has multiple versions.

                        version.jpg

                        The easiest is to just delete all folders starting with VMware.

                         

                        Or run

                         

                        Get-Module -Name VMware* -ListAvailable |

                        Uninstal-Module -Force -Confirm:$false

                         

                        • 9. Re: Having trouble installing Power Cli
                          LucD Guru
                          Community WarriorsvExpertUser Moderators

                          When you run

                           

                          Get-Module -Name VMware* -ListAvailable

                           

                          you should see more lines (see my previous screenshot)

                          • 10. Re: Having trouble installing Power Cli
                            vmk2014 Hot Shot

                            sorry not allowing.

                             

                             

                            PS C:\temp> Get-Module -Name VMware* -ListAvailable | Unistall-Module -Force -Confirm:$false

                            Unistall-Module : The term 'Unistall-Module' is not recognized as the name of a cmdlet, function, script file, or

                            operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

                            again.

                            At line:1 char:43

                            + Get-Module -Name VMware* -ListAvailable | Unistall-Module -Force -Con ...

                            +                                           ~~~~~~~~~~~~~~~

                                + CategoryInfo          : ObjectNotFound: (Unistall-Module:String) [], CommandNotFoundException

                                + FullyQualifiedErrorId : CommandNotFoundException

                            • 11. Re: Having trouble installing Power Cli
                              LucD Guru
                              User ModeratorsCommunity WarriorsvExpert

                              I think you have a typo in there, that should be Uninstall-Module.

                              • 12. Re: Having trouble installing Power Cli
                                vmk2014 Hot Shot

                                LucD,

                                 

                                I didnt find any VMware folder under programm(x86) path

                                 

                                 

                                 

                                S C:\temp> Get-Module -Name VMware* -ListAvailable | Unistal-Module -Force -Confirm:$false

                                nistal-Module : The term 'Unistal-Module' is not recognized as the name of a cmdlet, function, script file, or

                                perable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

                                gain.

                                t line:1 char:43

                                Get-Module -Name VMware* -ListAvailable | Unistal-Module -Force -Conf ...

                                                                           ~~~~~~~~~~~~~~

                                   + CategoryInfo          : ObjectNotFound: (Unistal-Module:String) [], CommandNotFoundException

                                   + FullyQualifiedErrorId : CommandNotFoundException

                                 

                                 

                                thanks

                                vmk

                                • 13. Re: Having trouble installing Power Cli
                                  vmk2014 Hot Shot

                                  Yup, corrected it but same result 

                                  • 14. Re: Having trouble installing Power Cli
                                    vmk2014 Hot Shot

                                    Yes, now it worked.

                                     

                                    PS C:\temp> Get-Module -Name VMware* -ListAvailable |Uninstall-Module -Force -Confirm:$false

                                    PS C:\temp>

                                     

                                    PS C:\temp> Get-Module -Name VMware* -ListAvailable

                                    1 2 3 Previous Next