VMware Cloud Community
Xanthus3
Contributor
Contributor
Jump to solution

PowerCLI Issues

Good morning,

      I have downloaded and installed the module, PowerCLI, from https://developer.vmware.com/powercli , offline version. I created a folder in Powershell modules named PowerCLI. I tried to run the first command to connect to ESX blade and got the following error.

"PS C:\WINDOWS\system32> connect-viserver -server 'my server name'
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 -server 172.20.6.133
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (connect-viserver:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule"

 

I have tried running the command import-module command and got this:

"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"

 

Ran this command to get info Get-Module -Name VMware* -ListAvailable | Select Name,Version:

Name Version
---- -------
VMware.CloudServices 12.2.0.17531656
VMware.DeployAutomation 7.0.2.17849781
VMware.ImageBuilder 7.0.2.17849781
VMware.PowerCLI 12.3.0.17860403
VMware.Vim 7.0.2.17839075
VMware.VimAutomation.Cis.Core 12.3.0.17839331
VMware.VimAutomation.Cloud 12.0.0.15940183
VMware.VimAutomation.Common 12.3.0.17838947
VMware.VimAutomation.Core 12.3.0.17839688
VMware.VimAutomation.Hcx 12.3.0.17860192
VMware.VimAutomation.HorizonView 12.3.0.17806051
VMware.VimAutomation.License 12.0.0.15939670
VMware.VimAutomation.Nsxt 12.3.0.17843496
VMware.VimAutomation.Sdk 12.2.0.17531155
VMware.VimAutomation.Security 12.3.0.17833870
VMware.VimAutomation.Srm 12.3.0.17843071
VMware.VimAutomation.Storage 12.3.0.17855705
VMware.VimAutomation.StorageUtility 1.6.0.0
VMware.VimAutomation.Vds 12.3.0.17856667
VMware.VimAutomation.Vmc 12.2.0.17531704
VMware.VimAutomation.vROps 12.2.0.17532798
VMware.VimAutomation.WorkloadManagement 12.3.0.17856842
VMware.VumAutomation 12.1.0.16941488

 

So as you can see, automation.core is being seen but it won't load.

Some notes to keep in mind. I can't download the module via PowerShell as I have to install it as an admin and admins don't have access to the internet. So installing from PowerShell is out.

Any help would greatly be appreciated.

Reply
0 Kudos
1 Solution

Accepted Solutions
Xanthus3
Contributor
Contributor
Jump to solution

Ok. I figured it out. Me creating a new folder (PowerCLI) inside of the module folder and unzipping the files to that folder, instead of just unzipping the contents of the zip to the module folder, was the culprit.

IE: I unzipped the files to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PowerCLI\ INSTEAD of C:\Windows\System32\WindowsPowerShell\v1.0\Modules\

That extra folder is the reason. Thank you for your time!

View solution in original post

10 Replies
wila
Immortal
Immortal
Jump to solution

Hi,

re. your "abuse report"

The antispam mechanism of this forum is overly active.
As soon as you post a link, the chances of your post getting tagged as spam increases about tenfold.
It does not seem to matter that the link is under the vmware.com domain (yes that makes no sense to me either)
Either way, I fished your post out of the spam queue.

--
Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
LucD
Leadership
Leadership
Jump to solution

Did you check if any of the folders in $env:PSModulePath points to the folder where the modules are located?
Did you install PowerCLI from a ZIP file or with the Install-Module cmdlet?


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

Reply
0 Kudos
Xanthus3
Contributor
Contributor
Jump to solution

I guess you can say installed it from the zip. I copied the files from the zip to the modules folder, inside of a new folder called PowerCLI. The Get-Module -Name VMware* -ListAvailable | Select Name,Version command see's the vmware modules I moved over. I then closed and reopened to see if that would populate. That has not.

Reply
0 Kudos
Xanthus3
Contributor
Contributor
Jump to solution

And just to be safe, I put that PowerCLI folder in all of the module locations.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

One folder should be enough 😉

After you downloaded the ZIP file, did you unblock it with the Unblock-File cmdlet?
See also PowerCLI Offline Installation Walkthrough


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

Reply
0 Kudos
Xanthus3
Contributor
Contributor
Jump to solution

Ok. I figured it out. Me creating a new folder (PowerCLI) inside of the module folder and unzipping the files to that folder, instead of just unzipping the contents of the zip to the module folder, was the culprit.

IE: I unzipped the files to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PowerCLI\ INSTEAD of C:\Windows\System32\WindowsPowerShell\v1.0\Modules\

That extra folder is the reason. Thank you for your time!

HelionAL
Contributor
Contributor
Jump to solution

Solution:

Set-ExecutionPolicy RemoteSigned

 

Br!

LucD
Leadership
Leadership
Jump to solution

Why are you posting this reply?
The execution policy has nothing to do with the issue the poster reported.


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

Reply
0 Kudos
HelionAL
Contributor
Contributor
Jump to solution

Because the tools are already installed.

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'.

Execution policy it's prohibiting them to run.

You can try it, set the execution policy to restricted, and try to load the command connect-viserver.

Waiting for your response.

Br!

 

LucD
Leadership
Leadership
Jump to solution

I didn't say the execution policy "Restricted" could not cause something similar.
But nothing in the submitter's description of his issue indicated anything about the execution policy.

As was confirmed by the submitter himself later on.
The issue was caused by not unblocking the downloaded ZIP file.

So again, please stop submitting nonsense, or at least read the thread carefully before submitting such replies.


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

Reply
0 Kudos