VMware Cloud Community
ispeakcomputer
Contributor
Contributor

Having issues getting install of PowerCLI working. Hoping you could help.

Hi,

I have tried many different ways of getting this working now for the last few days. I was hoping to reach out to the experts this time as I keep coming back to a error . I am following the video posted below from VMware. I have seen mention that this might be due to a network share which it looks like I am trying to load from before getting the error below. These a managed Windows 10 OS managed by our company. Please let me know if you have any other questions. I would be happy to help

https://www.youtube.com/watch?v=r2vi78DWkLQ

I am working with the following version of powershell

PS C:\Windows\system32> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.14393.1884
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.1884
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

The error I keep geting is as follows:

PS C:\Windows\system32> Connect-VIServer vcenter6.bdn.lab.xcal.tv
Connect-VIServer : The term 'Connect-VIServer' 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
+ Connect-VIServer vcenter6.bdn.***.xcal.tv
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Connect-VIServer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The order of commands that I used to get to this point:

(Get-Module VMware.PowerCLI -ListAvailable).RequiredModules | Uninstall-Module -Force

 Get-Module VMware.PowerCLI -ListAvailable | Uninstall-Module -Force

 Install-Module -Name VMware.PowerCLI -Scope CurrentUser

 

Output of listing Vmware modules:


 Get-Module VMware* -ListAvailable
    Directory: \\cable.***.com\corp-dfs\C**-CO Users\r***h225\My Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...
Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...
Manifest   11.0.0.... VMware.PowerCLI
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.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...
Script     11.0.0.... VMware.VimAutomation.Common
Script     11.0.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...
Script     7.6.0.1... VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}
Script     10.0.0.... VMware.VimAutomation.License        Get-LicenseDataManager
Script     11.0.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}
Script     11.0.0.... VMware.VimAutomation.Sdk
Script     11.0.0.... VMware.VimAutomation.Security       {Get-SecurityInfo, Get-VTpm, Get-VTpmCertificate, Get-VTpm...
Script     10.0.0.... VMware.VimAutomation.Srm            {Connect-SrmServer, Disconnect-SrmServer}
Script     11.0.0.... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePo...
Script     1.3.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script     11.0.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...
Script     11.0.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 (x86)\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...
Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...
Script     11.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...
Script     7.6.0.1... VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}
Script     10.0.0.... VMware.VimAutomation.License        Get-LicenseDataManager
Script     11.0.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}
Script     11.0.0.... VMware.VimAutomation.Security       {Get-SecurityInfo, Get-VTpm, Get-VTpmCertificate, Get-VTpm...
Script     10.0.0.... VMware.VimAutomation.Srm            {Connect-SrmServer, Disconnect-SrmServer}
Script     11.0.0.... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePo...
Script     1.3.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script     11.0.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...
Script     11.0.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...

0 Kudos
12 Replies
LucD
Leadership
Leadership

Can you check what this says?

$env:PSModulePath


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

0 Kudos
ispeakcomputer
Contributor
Contributor

Hi LucD,

Here is the Path output . Just redacted a few things.

\\cable.*****.com\corp-dfs\CHQ-CO Users\r*****225\My Documents\WindowsPowerShell\Modules; Users\r*****225\My Documents

\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules

;C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules

0 Kudos
LucD
Leadership
Leadership

Looks like the old PowerCLI folder is still in there (C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules).
I would suggest you do a complete uninstall/remove of everything PowerCLI that is on that station.

And then do a fresh install with Install-Module.

The post Welcome PowerCLI to the PowerShell Gallery – Install Process Updates will help.

Make sure there are no PowerCLI folders left in any of the folders mentioned in $env:PSMOdulePath.
Also make sure to clean up $env:PSModulePath by removing the old folder from there (this will require at least a logoff/logon)


In theory network folders should not be a problem for storing modules, but I would still go for folders on the local drive.
Remember that all modules folders need to be included in $env:PSModulePath to profit from module autoloading (available since PSv4).


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

0 Kudos
ispeakcomputer
Contributor
Contributor

Thanks so much for your help. I will get started working on this now.

0 Kudos
ispeakcomputer
Contributor
Contributor

Unfortunately , It seems to be installing exactly the same each time I do it. It looks like that module (VMware.VimAutomation.Core) is only installed in one folder ,but still doesn't seem to be loading. Instead there is an exception. I did close / and restart to try and get this working. Looks like autoload fails when I try Connect-VIserver. Connect-VIServer autocompletes the first time , but after the errors it doesn't any more.When it fails to autoload it tells me to try and import VMware.VimAutomation.Core directly for more information then I get the exception (Exception from HRESULT: 0x80131515). Ever happen to see this before ?

PS C:\Users\rwrigh225> Connect-VIServer vcenter6.bdn.lab.xcal.tv

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 'Import-Module VMware.VimAutomation.Core'.

At line:1 char:1

+ Connect-VIServer vcenter6.bdn.lab.xcal.tv

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

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

    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PS C:\Users\rwrigh225> Import-Module Vmware.VimAutomation.Core

Import-Module : Could not load file or assembly 'file://\\cable.comcast.com\corp-dfs\CHQ-CO Users\rwrigh225\My

Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\11.0.0.10334497\net45\ICSharpCode.SharpZipLib.dll' or

one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

At line:1 char:1

+ Import-Module Vmware.VimAutomation.Core

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

    + CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException

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

PS C:\Users\rwrigh225>

PS C:\Users\rwrigh225> Get-Module VMware* -ListAvailable

    Directory: \\cable.**********.com\corp-dfs\CHQ-CO Users\rw****h225\My Documents\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands

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

Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-Depl...

Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxIma...

Manifest   11.0.0.... VMware.PowerCLI

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.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-...

Script     11.0.0.... VMware.VimAutomation.Common

Script     11.0.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapt...

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

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

Script     11.0.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}

Script     11.0.0.... VMware.VimAutomation.Sdk

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

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

Script     11.0.0.... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePolic...

Script     1.3.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore

Script     11.0.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Expo...

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

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

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

    Directory: C:\Program Files (x86)\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands

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

Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-Depl...

Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxIma...

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

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

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

Script     11.0.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}

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

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

Script     11.0.0.... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePolic...

Script     1.3.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore

Script     11.0.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Expo...

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

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

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

0 Kudos
LucD
Leadership
Leadership

Did you do a Get-Module -Name VMware* -ListAvailable after you removed everything?
And did you check what is left in $env:PSModulePath after the removal step?

I have the impression that the modules on the network drive are not complete.
Some modules are missing, and seen the error, potentially some of the DLLs as well.

Best would be to get rid of those (if you can).

Another option could be to remove that network drive from $env:PSModulePath.
That is probably something you will need to through the System Variables, followed by a logoff/logon.


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

0 Kudos
LucD
Leadership
Leadership

Another remark, seen the location of the module folders (C:\Program Files (x86)\WindowsPowerShell\Modules), you probably did an Install-Module with Scope AllUsers.
Or were these modules already there?
You would probably need admin authority to remove the modules in C:\Program Files (x86)\WindowsPowerShell\Modules.

The ones on the network share seem to be the modules installed with Scope CurrentlUser.

Are you set up with a roaming profile and folder redirection?
In that case, those are probably the modules you just installed.

And they seem to be complete.

Can you perhaps check the timestamps on the module folders?


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

0 Kudos
ispeakcomputer
Contributor
Contributor

Hi,

I went through and checked every path for $psmodulepath and made sure that my install worked and it did. Everything looks like it it installed in one place now. I needed to uninstall as admin and it cleared everything. Then i reopened powershell without admin and did the install per current user as seen here. I am still getting the same error. Is this a bug of some sort ? Again,  Thanks for you help with this.

Windows PowerShell

Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Users\rwrigh225> Get-Module VMware* -ListAvailable

    Directory: \\cable.comcast.com\corp-dfs\CHQ-CO Users\rwrigh225\My Documents\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.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...

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

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

Script     11.0.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}

Script     11.0.0.... VMware.VimAutomation.Sdk

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

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

Script     11.0.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...

PS C:\Users\rwrigh225> Connect-VIServer vcenter6.bdn.lab.xcal.tv

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 'Import-Module VMware.VimAutomation.Core'.

At line:1 char:1

+ Connect-VIServer vcenter6.bdn.lab.xcal.tv

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

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

    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PS C:\Users\rwrigh225> Import-Module Vmware.VimAutomation.Core

Import-Module : Could not load file or assembly 'file://\\cable.comcast.com\corp-dfs\CHQ-CO Users\rwrigh225\My

Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\11.0.0.10334497\net45\ICSharpCode.SharpZipLib.dll' or

one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

At line:1 char:1

+ Import-Module Vmware.VimAutomation.Core

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

    + CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException

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

PS C:\Users\rwrigh225>    

0 Kudos
ispeakcomputer
Contributor
Contributor

Sorry , I should have added that I checked all the paths in psmodulepath and made sure it was clear of installed modules.

0 Kudos
LucD
Leadership
Leadership

You are still missing some of the modules, so the install didn't work out.
Must be/could that network drive I suspect.
Is there any way to eliminate that folder redirection, just so you can install locally?

The complete list should show

modules.jpg


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

0 Kudos
ispeakcomputer
Contributor
Contributor

Good to know I am missing stuff. Didn't realize. I will work on seeing what I can do to better this. Thank you for your help.

0 Kudos
Paul_Czopowik
Contributor
Contributor

Were you ever able to figure this out? I have two Windows 10 workstations that are new installs and I cannot get this to work. I was able to do it on my old workstation no problem, but i think it was an older version of PowerCLI. I simply run the install module command, everything works fine, but i cannot run any commands.

0 Kudos