External Script driver error when starting Exchange cmd

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 9 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
JorisK1980
Posts: 30
Last visit: Fri Nov 16, 2018 1:40 am

External Script driver error when starting Exchange cmd

Post by JorisK1980 »

Hi,

When i run my application, everything starts fine without any error. I press a button and i see in the Output screen the Exchange 2010 powershell functions load and i see them connecting to my Exchange server, so far nothing special.

Now it comes:
When i press a button that does for example Get-MailboxDatabase, i receive the following in the output screen:
ERROR: The type initializer for 'Microsoft.Exchange.Diagnostics.ExTraceConfiguration' threw an exception.
ERROR: + CategoryInfo : OperationStopped: (System.Manageme...pressionSyncJob:PSInvokeExpressionSyncJob) [], PSRemotingTransportException
ERROR: + FullyQualifiedErrorId : JobFailure
ERROR:

I get a window saying External Script Driver has stopped working.
Problem signature:
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: scriptdriver64elevated.exe
Problem Signature 02: 1.1.23.0
Problem Signature 03: 531245be
Problem Signature 04: Microsoft.Exchange.Diagnostics
Problem Signature 05: 14.3.151.0
Problem Signature 06: 51a5b2b9
Problem Signature 07: 59b
Problem Signature 08: c
Problem Signature 09: System.NullReferenceException
OS Version: 6.1.7601.2.1.0.16.7
Locale ID: 1043
Additional Information 1: 9993
Additional Information 2: 999325e2cb669f2b21d583f252486cfb
Additional Information 3: a14b
Additional Information 4: a14b33d34e19631c620303739f0b2e72


The funny thing is, when i start this command from an almost empty application, it runs fine.

What can be conflicting here?
User avatar
JorisK1980
Posts: 30
Last visit: Fri Nov 16, 2018 1:40 am

Re: External Script driver error when starting Exchange cmd

Post by JorisK1980 »

A small update:

When i build the application and i try it, no error occurs. It only seems to happen when beeing launched from PS2012.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: External Script driver error when starting Exchange cmd

Post by jvierra »

Sorry but your information is vague and ambiguous.

What is PS2012? PrimalScript or PowerShell Studio?

What system are you running this on?

What is the minimum amount of code that reproduces the problem?
User avatar
JorisK1980
Posts: 30
Last visit: Fri Nov 16, 2018 1:40 am

Re: External Script driver error when starting Exchange cmd

Post by JorisK1980 »

The problem occurs with Powershell Studio 2012, i have the same results in Powershell Studio 2014.

The script runs fine, but once i press a button, i load the Exchange 2010 powershell commandlets (Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010) and this happens in the debug screen:
>> Merging 'exchange.psf' ...
>> Writing 'DCBeheer.Run.ps1' ...
>> Platform: V2 64Bit (STA)
ERROR: Add-PSSnapin : Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.E2010 because of the following error: The type initializer for '
ERROR: Microsoft.Exchange.Data.Directory.Globals' threw an exception.
mainmenu.psf (92): ERROR: At Line: 92 char: 14
ERROR: + Add-PSSnapin <<<< Microsoft.Exchange.Management.PowerShell.E2010
ERROR: + CategoryInfo : InvalidData: (Microsoft.Excha...owerShell.E2010:String) [Add-PSSnapin], PSSnapInException
ERROR: + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
ERROR:
>> Script Ended

This is the error that pops up:




Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: scriptdriver64.exe
Problem Signature 02: 1.2.27.0
Problem Signature 03: 533d08db
Problem Signature 04: Microsoft.Exchange.Diagnostics
Problem Signature 05: 14.3.123.2
Problem Signature 06: 510f643e
Problem Signature 07: 59b
Problem Signature 08: c
Problem Signature 09: System.NullReferenceException
OS Version: 6.1.7601.2.1.0.16.7
Locale ID: 1043
Additional Information 1: 9993
Additional Information 2: 999325e2cb669f2b21d583f252486cfb
Additional Information 3: a14b
Additional Information 4: a14b33d34e19631c620303739f0b2e72


FYI: The script runs perfect when exported to an .exe file.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: External Script driver error when starting Exchange cmd

Post by Alexander Riedel »

Wrong forum. This is not a product support forum.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 9 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked