PowerCLI

 View Only
  • 1.  Script import-module Catastrophic failure

    Posted Mar 14, 2016 08:26 PM

    I currently am having an issue with a script we are scheduling through our RMM tool Kaseya. In my script I am importing the vmware.vimautomation.core module and it works great when I run the script manually.

    However when I run the script through our RMM tool I am getting an error when trying to import the module. The RMM tool is using an account with full permissions. Below is the error that I am getting.

    Import-Module : Exception calling "LoadFile" with "1" argument(s):

    "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"At

    C:\vsm.ps1:22 char:9

    +         Import-Module VMware.VimAutomation.Core -ea stop

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

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

       ionException

        + FullyQualifiedErrorId : COMException,Microsoft.PowerShell.Commands.Impor

       tModuleCommand



  • 2.  RE: Script import-module Catastrophic failure

    Posted Mar 15, 2016 06:25 AM

    Which PowerCLI version is this ?

    Do a Get-PowerCLIVersion



  • 3.  RE: Script import-module Catastrophic failure

    Posted Mar 15, 2016 01:30 PM

    PowerCLI Version

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

       VMware vSphere PowerCLI 6.0 Release 3 build 3205540

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

    Component Versions

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

       VMWare AutoDeploy PowerCLI Component 6.0 build 2358282

       VMWare ImageBuilder PowerCLI Component 6.0 build 2358282

       VMware vSphere PowerCLI Component 6.0 build 3205541

       VMware Cloud Infrastructure Suite PowerCLI Component 6.0 build 3205541

       VMware VDS PowerCLI Component 6.0 build 3205541

       VMware vCloud Director PowerCLI Component 6.0 build 3191743

       VMware HA PowerCLI Component 6.0 build 2591578

       VMware License PowerCLI Component 6.0 build 3188616

       VMware vCloud Air PowerCLI Component 6.0 build 3191743

       VMware PowerCLI Component for Storage Management 6.0 build 3191741

       VMware vROps PowerCLI Component 6.0 build 3191742

       VMware vSphere Update Manager PowerCLI 6.1 build 3191523



  • 4.  RE: Script import-module Catastrophic failure

    Posted Mar 15, 2016 02:59 PM

    Can you ask for more details about the exception ?

    Perhaps there is a pointer in there.

    $error[0].Exception | select *

    $error[0].Exception.InnerException | select *



  • 5.  RE: Script import-module Catastrophic failure

    Posted Mar 15, 2016 03:20 PM

    Thanks for that.  Below is the error:

    Import-Module : Exception calling "LoadFile" with "1" argument(s):
    "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"At
    C:\vsm.ps1:22 char:9
    +         Import-Module VMware.VimAutomation.Core -ea stop
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Import-Module], MethodInvocat
       ionException
        + FullyQualifiedErrorId : COMException,Microsoft.PowerShell.Commands.Impor
       tModuleCommand


    ErrorRecord                 : Exception calling "LoadFile" with "1"
                                  argument(s): "Catastrophic failure (Exception
                                  from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
    StackTrace                  :    at System.Management.Automation.ExceptionHandl
                                  ingOps.ConvertToMethodInvocationException(Excepti
                                  on exception, Type typeToThrow, String
                                  methodName, Int32 numArgs, MemberInfo memberInfo)
                                     at CallSite.Target(Closure , CallSite ,
                                  RuntimeType , Object )
                                     at System.Dynamic.UpdateDelegates.UpdateAndExe
                                  cute2[T0,T1,TRet](CallSite site, T0 arg0, T1
                                  arg1)
                                     at System.Management.Automation.Interpreter.Dy
                                  namicInstruction`3.Run(InterpretedFrame frame)
                                     at System.Management.Automation.Interpreter.En
                                  terTryCatchFinallyInstruction.Run(InterpretedFram
                                  e frame)
    WasThrownFromThrowStatement : False
    Message                     : Exception calling "LoadFile" with "1"
                                  argument(s): "Catastrophic failure (Exception
                                  from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
    Data                        : {System.Management.Automation.Interpreter.Interpr
                                  etedFrameInfo}
    InnerException              : System.Runtime.InteropServices.COMException
                                  (0x8000FFFF): Catastrophic failure (Exception
                                  from HRESULT: 0x8000FFFF (E_UNEXPECTED))
                                     at System.Reflection.RuntimeAssembly.nLoadFile
                                  (String path, Evidence evidence)
                                     at System.Reflection.Assembly.LoadFile(String
                                  path)
                                     at CallSite.Target(Closure , CallSite ,
                                  RuntimeType , Object )
    TargetSite                  : Void ConvertToMethodInvocationException(System.Ex
                                  ception, System.Type, System.String, Int32,
                                  System.Reflection.MemberInfo)
    HelpLink                    :
    Source                      : System.Management.Automation
    HResult                     : -2146233087



  • 6.  RE: Script import-module Catastrophic failure

    Posted Mar 15, 2016 06:35 PM

    Never seen that one before, looks serious.

    Do you have that only with the PowerCLI module(s) ?

    A specific one ?

    Or also with other modules ?



  • 7.  RE: Script import-module Catastrophic failure

    Posted Mar 21, 2016 03:44 PM

    Sorry for the late reply.

    Yes it appears to only be PowerCLI modules. I was able to successfully load ActiveDirectory module just fine.

    I tested with other PowerCLI modules with the same result.

    I was leaning towards an issue to .NET. Correct me if I am wrong, the new PowerCLI modules are built on .NET4?? Looking online showed similar issues and creating a wsmprovhost.exe.config file that contains the below info

    <?xml version="1.0"?>

    <configuration>

      <startup useLegacyV2RuntimeActivationPolicy="true">

       <supportedruntime version="v4.0.30319"/>

       <supportedruntime version="v2.0.50727"/>

      </startup>

    </configuration>

    This would work for the next subsequent run of the script but then fail thereafter.

    I also tested this with a powershell.exe.config file and the same results happened. First run after modification was successful but any after failed. Even following a reboot.



  • 8.  RE: Script import-module Catastrophic failure

    Posted Mar 21, 2016 05:02 PM

    You are correct on the .Net requirements. See the PowerCLI compatibility matrix.

    That .config file sets up the "old" .Net 2 binding.

    Could it be that some previous installation was not uninstalled properly ?

    Can you replicate the same issues on another station ?



  • 9.  RE: Script import-module Catastrophic failure

    Posted Mar 21, 2016 07:48 PM

    Ok, so removing the reference for .NET 2 wouldn't accomplish anything?

    I've got about 150 Windows vCenter Servers and about 30% of them report the same issue. They will initially work and then stop. On occasion, I've had some machines start working and continue to work until a reboot.



  • 10.  RE: Script import-module Catastrophic failure

    Posted Mar 21, 2016 08:24 PM

    That all sounds very strange, I would strongly suggest to open a SR for this.

    PowerCLI is supported! (as long as you don't expect Support to debug your scripts :smileygrin:)