PowerCLI

 View Only
  • 1.  The term 'Connect-VIServer' is not recognized as the name of a cmdlet

    Posted Oct 07, 2020 07:38 PM

    Hi,

    I haveWin 2016 server which doesnt have internet connection.

    If I run the command 'Connect-VIServer -Server <VC>' then I was getting the error: The term 'Connect-VIServer' is not recognized as the name of a cmdlet

    Hence I downloaded : 'VMware.VimAutomation.Core 11.5.0.14899560' from the below link from my local machine and copied the file 'vmware.vimautomation.core.11.5.0.14899560.nupkg' into that 2016 server in the location: D:\New folder

    https://www.powershellgallery.com/packages/VMware.VimAutomation.Core/11.5.0.14899560

    Then I ran the command

    Unblock-File -Path 'D:\New folder\vmware.vimautomation.core.11.5.0.14899560.nupkg'

    And then changed the format to vmware.vimautomation.core.zip and then extracted it.

    Then I copied that new extracted folder to C:\Windows\System32\WindowsPowerShell\v1.0\Modules

    Then I opened the powershell as Admin and then ran the command and I was getting this error:

    PS C:\WINDOWS\system32>> Install-module 'C:\Windows\System32\WindowsPowerShell\v1.0\Modules\vmware.vimautomation.core'

    WARNING: Unable to download the list of available providers. Check your internet connection.

    PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.

    PS C:\WINDOWS\system32>> Import-module C:\Windows\System32\WindowsPowerShell\v1.0\Modules\vmware.vimautomation.core

    Import-module : The required module 'VMware.VimAutomation.Cis.Core' is not loaded. Load the module or remove the module from 'RequiredModules' in the file

    'C:\Windows\System32\WindowsPowerShell\v1.0\Modules\vmware.vimautomation.core\vmware.vimautomation.core.psd1'.

    PS C:\WINDOWS\system32>> Connect-VIServer -Server <VC>

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

    Any help please?



  • 2.  RE: The term 'Connect-VIServer' is not recognized as the name of a cmdlet
    Best Answer

    Posted Oct 07, 2020 07:45 PM

    Can you try the method described in PowerCLI Offline Installation Walkthrough and check if that gives the same result?

    Remove all current PowerCLI folders before you do that.



  • 3.  RE: The term 'Connect-VIServer' is not recognized as the name of a cmdlet

    Posted Jan 19, 2023 02:39 PM

    Solution:

    Check the execution policy

    Get-ExecutionPolicy - if it is restricted change it to RemoteSigned

    Set-ExecutionPolicy RemoteSigned

    If you are getting cert error:

    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false



  • 4.  RE: The term 'Connect-VIServer' is not recognized as the name of a cmdlet

    Posted Jan 19, 2023 02:56 PM

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