BookmarkSubscribeRSS Feed
LenFocus
Calcite | Level 5

Hi all,

 

I am using PowerShell 4.0 to call up SAS EG object for generating reports.

 

  $eguideApp=New-Object -comObject  "SASEGObjectModel.Application.7.1"

Occasionally exception would be thrown with the following information in the error log:

 

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'SAS.Shared.SharedEnvironment' threw an exception. ---> System.Management.ManagementException: Provider load failure
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
at SAS.Shared.HWInfo.InitInfo()
at SAS.Shared.SharedEnvironment..cctor()
--- End of inner exception stack trace ---
at SAS.Shared.SharedEnvironment.get_SharedDataFolder()
at SAS.EG.Scripting.Application..ctor(String _cmdLineProvider)
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Microsoft.PowerShell.Commands.NewObjectCommand.SafeCreateInstance(Type t, Object[] args)
at Microsoft.PowerShell.Commands.NewObjectCommand.CreateComObject()
at Microsoft.PowerShell.Commands.NewObjectCommand.BeginProcessing()
at System.Management.Automation.Cmdlet.DoBeginProcessing()
at System.Management.Automation.CommandProcessorBase.DoBegin() :

 

I have no idea what 's going on and try again to make all the things done.

 

Thanks.

5 REPLIES 5
JuanS_OCS
Azurite | Level 17

Hi,

 

I am not sure about what is going on over there, but I can imagine the following possibilities:

 

1 - A provider is failing, as your log mentions. For troubleshooting this, you can follow this wonderful guide https://blogs.technet.microsoft.com/heyscriptingguy/2012/09/12/use-powershell-to-troubleshoot-provid...

 

2- When you manually load/run the EG client, are you finding any error anytime? Please check.

- Probably you can enable the Logs of Enterprise guide and see if there is anything over there: http://support.sas.com/kb/55/414.html 

 

3- I can see an error related to the load/location of the Shared Data folder, which is strange, unless you already made connection to a metadata server. If you did, maybe there is something on the metadata server logs (permissions on the Shared Data folder?)

 

4- Less frequent, but also possible, maybe not all the dlls of EG or .NET are properly registered. For .NET I suggest a clean re-installation of the framework, and for EG, you can run EGuide.exe -register (or /register). 

LenFocus
Calcite | Level 5

Hi,

 

Thanks but I still could not work out the solution in these few weeks.

 

1. Still trying but no hints can be found.

2. Manual launch did not show the error.

3. A connection has been set in the default profile an credential. I am not sure whether the connection is establishing once "new-object" is called.

4. I also think in this way. But not sure which .dlls I have to re-register.

 

 

 

 

ChrisHemedinger
Community Manager

I think the exception is happening when EG is trying to connect to your SAS environment using your stored credentials.  I don't know why it's happening, but if your script is running several times in succession or in parallel, perhaps it's a contention issue.  I don't think it's a DLL registration problem -- the fact that you're getting into EG application code shows that the EG object model is properly registered.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
LenFocus
Calcite | Level 5
Chris,
You are right. It's hard to find out what is going on.
I try to inspect the log files "powershell_log.#####.txt" generated by EG.

It was embarrassed that no such file generated when the problem occurred. The case was stuck on "New-Object" of "SASEGObjectModel". The case did not reproduce every time and occurred in an random manner. It was pretty hard to troubleshoot.
My information was only relied on the $_.Exception catched by PowerShell script.
LenFocus
Calcite | Level 5

WMI-activity has been shown the following event:

 

Id = {DC7E0B54-5DA3-0006-5A2B-83DCA35DD101}; ClientMachine = ABCDIIS01; User = contoso\user; ClientProcessId = 5288; Component = Unknown; Operation = Start IWbemServices::CreateInstanceEnum - root\cimv2 : Win32_ComputerSystem; ResultCode = 0x80041013; PossibleCause = Unknown

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2497 views
  • 0 likes
  • 3 in conversation