Automation

 View Only
  • 1.  Having issues with offline installation

    Posted Sep 01, 2020 02:48 PM

    Hello,

    I have a server(w2k16) that is used in prod and I cannot use the nuget package for installation. :

    Using this post

    https://blogs.vmware.com/PowerCLI/2018/01/powercli-offline-installation-walkthrough.html

    I have attempted to do an offline install

    1.     Download zip https://code.vmware.com/web/tool/12.0.0/vmware-powercli
    2.     extract zip and place in $pshome\Modules - for PRD that was -    PS C:\Windows\system32> C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
    3.     Run PS as admin

    When I try to connect to my vCenter the autocomplete works, but I get this error.

    PS C:\Windows\system32> Connect-VIServer 10.x.x.x

    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 10.x.x.x

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

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

        + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

    So I ran:

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

    Import-Module : Could not load file or assembly

    'file:///C:\Windows\system32\WindowsPowerShell\v1.0\Modules\VMware.Vim\net45\InternalVimService50.Wcf.dll' or one of

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

    At line:1 char:1

    + Import-Module VMware.VimAutomation.Cis.Core

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

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

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


    For reference:

    $PSVersionTable

    Name Value

    ---- -----

    PSVersion 5.1.14393.3866

    PSEdition Desktop

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

    BuildVersion 10.0.14393.3866

    CLRVersion 4.0.30319.42000

    WSManStackVersion 3.0

    PSRemotingProtocolVersion 2.3

    SerializationVersion 1.1.0.1

    Is this the right process and where should I go from here?



  • 2.  RE: Having issues with offline installation

    Posted Sep 01, 2020 04:52 PM

    Did you unlock the ZIP file?
    Did you check what you have in $env:PSModulePath?

    Do the PowerCLI list when you do a Get-Module -Name VMware* -ListAvailable?



  • 3.  RE: Having issues with offline installation

    Posted Sep 01, 2020 05:31 PM


    I saw this post where you discussed the locking issue
    Re: Installing PowerCLI


    That result was:

    PS C:\Windows\system32> Get-ChildItem -Path 'C:\Windows\System32\WindowsPowerShell\v1.0\Modules\VMware*' -Recurse | Unbl

    ock-File

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

    Unable to find type [VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory].

    At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\VMware.VimAutomation.Core\net45\VMware.VimAutomation.Core.ps1:1

    char:1

    + [VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory]::CoreService ...

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

        + CategoryInfo          : InvalidOperation: (VMware.VimAutom...eServiceFactory:TypeName) [], RuntimeException

        + FullyQualifiedErrorId : TypeNotFound

    Import-Module : Could not load file or assembly 'VMware.VimAutomation.Sdk.Interop, Version=12.0.0.2889,

    Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\VMware.VimAutomation.Core\VMware.VimAutomation.Core.psm1:23

    char:17

    + $binaryModule = Import-Module -Name $binaryModulePath -PassThru

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

        + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundException

        + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

    I used the default module path for all users:

    PS C:\Windows\system32> $env:PSModulePath

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

    )\Microsoft SQL Server\110\Tools\PowerShell\Modules\

    PS C:\Windows\system32>


    Unless maybe I need to specify
    C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
    instead of
    C:\Windows\System32\WindowsPowerShell\v1.0

    Available modules comes back as

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

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

    ModuleType Version    Name                                ExportedCommands

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

    Script     12.0.0.... VMware.CloudServices                {Connect-Vcs, Get-VcsOrganizationRole, Get-VcsService, Get-VcsServiceRole...}

    Script     7.0.0.1... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-DeployRule...}

    Script     7.0.0.1... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Export-EsxImageProfile...}

    Manifest   12.0.0.... VMware.PowerCLI

    Script     7.0.0.1... VMware.Vim

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

    Script     12.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog...}

    Script     12.0.0.... VMware.VimAutomation.Common         {Get-Task, New-OAuthSecurityContext, Stop-Task, Wait-Task}

    Script     12.0.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer...}

    Script     12.0.0.... VMware.VimAutomation.Hcx            {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance, Get-HCXComputeProfile...}

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

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

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

    Script     12.0.0.... VMware.VimAutomation.Sdk            Get-ErrorReport

    Script     12.0.0.... VMware.VimAutomation.Security       {Add-AttestationServiceInfo, Add-KeyProviderServiceInfo, Add-TrustAuthorityKeyProviderServer, Add-TrustA

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

    Script     12.0.0.... VMware.VimAutomation.Storage        {Add-EntityDefaultKeyProvider, Add-KeyManagementServer, Add-VsanFileServiceOvf, Add-VsanObjectToRepairQu

    Script     1.3.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore

    Script     12.0.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup, Export-VDSwitch...}

    Script     12.0.0.... VMware.VimAutomation.Vmc            {Add-VmcSddcHost, Connect-Vmc, Disconnect-Vmc, Get-AwsAccount...}

    Script     12.0.0.... VMware.VimAutomation.vROps          {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition...}

    Script     12.0.0.... VMware.VimAutomation.WorkloadMan... {Get-WMNamespace, Get-WMNamespacePermission, Get-WMNamespaceStoragePolicy, New-WMNamespace...}

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



  • 4.  RE: Having issues with offline installation
    Best Answer

    Posted Sep 01, 2020 06:09 PM

    Ok, so the modules are found.

    Although we normally don't install them in that System32 folder anymore.

    I would suggest installing them in the C:\Users\pjohns_apo\Documents\WindowsPowerShell\Modules folder.

    You can unlock a ZIP file also from the File Explorer.

    Select the ZIP file, select properties and there is an Unlock option



  • 5.  RE: Having issues with offline installation

    Posted Sep 02, 2020 02:35 PM

    LucD,

    Moving the modules to

    C:\Users\[username]\Documents\WindowsPowerShell\Modules

    Seemed to work. i can now connect to the vCenter and run my tasks.

    Thank you!