Highlighted
Expert
Expert

Having trouble installing Power Cli

Jump to solution

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

Tags (1)
0 Kudos
33 Replies
Highlighted
User Moderator
User Moderator

You do seem to have the PowerCLI modules in the C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerCLI folder?
Any clue how they got there?
I would suggest to delete those VMware folders in that folder, that is not where they belong.

The correct line to find the PowerCLI modules is

Find-Module -Name VMware.PowerCLI

or
Find-Module -Name VMware*


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

0 Kudos
Highlighted
Enthusiast
Enthusiast

I deleted PowerCLI modules from C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerCLI folder

S C:\Windows\system32> Find-Module -Name VMware.PowerCLI

PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'VMware.PowerCLI'. Try Get-PSRepository to see all available regist

ered module repositories.

At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1397 char:3

+         PackageManagement\Find-Package @PSBoundParameters | Microsoft ...

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

    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception

    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

PS C:\Windows\system32> Find-Module -Name VMware*

PS C:\Windows\system32>

0 Kudos
Highlighted
User Moderator
User Moderator

Did you do that from a station that is able to access the Internet?
Are you behind a proxy?

Can you try to register the repository?

Register-PSRepository -Name "PSGallery" –SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted


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

0 Kudos
Highlighted
Enthusiast
Enthusiast

I have access to internet but there is a proxy. I try form public network also but I got same result.

S C:\Windows\system32> Register-PSRepository -Name "PSGallery" –SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted

Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable.  Please try again later.

At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4095 char:9

+         Get-PSGalleryApiAvailability -Repository $Name

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

    + CategoryInfo          : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException

    + FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

Register-PSRepository : Use 'Register-PSRepository -Default' to register the PSGallery repository.

At line:1 char:1

+ Register-PSRepository -Name "PSGallery" –SourceLocation "https://www. ...

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

    + CategoryInfo          : InvalidArgument: (PSGallery:String) [Register-PSRepository], ArgumentException

    + FullyQualifiedErrorId : UseDefaultParameterSetOnRegisterPSRepository,Register-PSRepository

0 Kudos
Highlighted
User Moderator
User Moderator

Did you try with

Register-PSRepository -Default

as well?


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

0 Kudos
Highlighted
Enthusiast
Enthusiast

PS C:\Windows\system32> Register-PSRepository -Default

PackageManagement\Register-PackageSource : Module Repository 'PSGallery' exists.

At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4211 char:17

+ ...     $null = PackageManagement\Register-PackageSource @PSBoundParamete ...

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

    + CategoryInfo          : ResourceExists: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-PackageSource], Exception

    + FullyQualifiedErrorId : PackageSourceExists,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource

0 Kudos
Highlighted
User Moderator
User Moderator

If that entry already exists, you of course have to unregister it first.

Unregister-PSRepository -Name PSGallery

Register-PSRepository -Default


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

0 Kudos
Highlighted
Enthusiast
Enthusiast

this is really annoying Smiley Sad

PS C:\Windows\system32> Unregister-PSRepository -Name PSGallery

Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable.  Please try again later.

At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4432 char:9

+         Get-PSGalleryApiAvailability -Repository $Name

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

    + CategoryInfo          : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException

    + FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

0 Kudos
Highlighted
User Moderator
User Moderator

You are using rather old PowerShellGet version.
Try to get your PowerShell environment in order first.
You can try to follow the instructions in UPDATE POWERSHELLGET AND PACKAGEMANAGEMENT


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

0 Kudos
Highlighted
Enthusiast
Enthusiast

hi ,

I don't know what I didn't try , I must start over.

PS C:\Windows\system32> Connect-VIServer  172.16.10.10

Connect-VIServer : The 'Connect-VIServer' command was found in the module 'VMware.VimAutomation.Core', but the module could not be loaded. For more information, run 'Imp

ort-Module VMware.VimAutomation.Core'.

At line:1 char:1

+ Connect-VIServer 172.16.10.10

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

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

    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PS C:\Windows\system32> Import-Module VMware.VimAutomation.Core

Import-Module : The specified module 'VMware.VimAutomation.Core' was not loaded because no valid module file was found in any module directory.

At line:1 char:1

+ Import-Module VMware.VimAutomation.Core

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

    + CategoryInfo          : ResourceUnavailable: (VMware.VimAutomation.Core:String) [Import-Module], FileNotFoundException

    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

0 Kudos
Highlighted
Enthusiast
Enthusiast

I mange to install finally . But whet I try Get-Snapshot I getting an error .

Get-Snapshot            Value cannot be found for the mandatory parameter VM

At line:1 char:1

+ Get-Snapshot

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

    + CategoryInfo          : NotSpecified: (:) [Get-Snapshot], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetSnapshot

Get-Module -Name vmware.powercli -ListAvailable

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

ModuleType Version    Name                                ExportedCommands

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

Manifest   11.2.0.... VMware.PowerCLI

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands

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

Manifest   6.5.4.7... VMware.PowerCLI

Do I need to remove 6.5.4.7 PowerCLI ?

0 Kudos
Highlighted
User Moderator
User Moderator

No,you can normally have different versions of the same module installed.
The PS engine will pick the most recent version.

Do you have all the other PowerCLI modules?

Do a

Get-Module -Name VMware* -ListAvailable


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

0 Kudos
Highlighted
Enthusiast
Enthusiast

yes , I have

Get-Module -Name VMware* -ListAvailable

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

ModuleType Version    Name                                ExportedCommands

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

Script     6.7.0.1... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...

Script     6.7.0.1... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...

Manifest   11.2.0.... VMware.PowerCLI

Script     6.7.0.1... VMware.Vim

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

Script     11.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...

Script     11.2.0.... VMware.VimAutomation.Common

Script     11.2.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...

Script     11.2.0.... VMware.VimAutomation.Hcx            {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance...

Script     7.6.0.1... VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}

Script     10.0.0.... VMware.VimAutomation.License        Get-LicenseDataManager

Script     11.2.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtPolicy...

Script     11.2.0.... VMware.VimAutomation.Sdk            {Get-ErrorReport, Get-PSVersion, Get-InstallPath}

Script     11.0.0.... VMware.VimAutomation.Security       {Get-SecurityInfo, Get-VTpm, Get-VTpmCertificate, Get-VTpm...

Script     11.2.0.... VMware.VimAutomation.Srm            {Connect-SrmServer, Disconnect-SrmServer}

Script     11.2.0.... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePo...

Script     1.3.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore

Script     11.2.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...

Script     11.2.0.... VMware.VimAutomation.Vmc            {Connect-Vmc, Disconnect-Vmc, Get-VmcSddcNetworkService, G...

Script     10.0.0.... VMware.VimAutomation.vROps          {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-O...

Script     6.5.1.7... VMware.VumAutomation                {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Complia...

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands

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

Manifest   6.5.4.7... VMware.PowerCLI

Script     6.5.4.7... VMware.VimAutomation.HA             Get-DrmInfo

Script     10.0.0.... VMware.VimAutomation.PCloud         {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInsta...

Binary     6.5.1.5... VMware.VimAutomation.PCloud         {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInsta...

0 Kudos
Highlighted
User Moderator
User Moderator

That looks ok.
The Get-Snapshot requires a VM parameter, so try running

Get-VM | Get-Snapshot


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