MapiExceptionLowLevelInitializationFailure

T

Tim Munro

Hi all,
I am running Windows XP SP3 with the Exchange 2007 (x86) Exchange
Management Tools installed.

I have VB.NET (2008) project underway that invokes a Powershell
subprocess using standard procedures found on the web. Generally it works
very well. I have successfully invoked the following PS commands and
returned their results:

Enable-Mailbox
New-Mailbox
Get-User
Get-MailUser
Get-Mailbox

But when I try Get-MailboxStatistics I get:
MapiExceptionLowLevelInitializationFailure: Unable to load exrpc32.dll or
one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll, etc.)

All commands work perfectly in the Exchange Management Shell.

I've read the thread on the Web between "Mathias", "Karl Mitschke" and
"SvenC" but it just ends with no resolution.

Here's the Function:

Function RunExchCommand(ByVal PSCommand As Command) As IEnumerable
Dim RunSpace As Runspace
Dim RsConfig As RunspaceConfiguration
Dim SnapInInfo As PSSnapInInfo
Dim warning As PSSnapInException = New PSSnapInException()
Dim Results As IEnumerable

RsConfig = RunspaceConfiguration.Create
SnapInInfo =
RsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin",
warning)
If Not IsNothing(warning) Then
MsgBox("Error loading Exchange 2007 Management shell" & vbCrLf &
vbCrLf & warning.Message)
RunExchCommand = Nothing
Exit Function
End If
RunSpace = RunspaceFactory.CreateRunspace(RsConfig)
RunSpace.Open()
Dim MyPipeLine As Pipeline = RunSpace.CreatePipeline()

MyPipeLine.Commands.Add(PSCommand)
Try
Results = MyPipeLine.Invoke()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
Results = Nothing
End Try
RunExchCommand = Results
End Function

Here's the calling code snippet:

MyCommand = New Command("Get-MailboxStatistics")
MyCommand.Parameters.Add("Identity", sDN)
'
' It dies at this next command
'
' There's nothing here that I have not done elsewhere except the actual
PS command itself
'
PSResults = DirectCast(RunExchCommand(MyCommand), IList)
MBXStats = DirectCast(PSResults(0), PSObject)
If DirectCast(Mailbox.Properties("HiddenFromAddressListsEnabled").Value,
Boolean) Then
Hidden_chk.Checked = True
End If
If DirectCast(Mailbox.Properties("UseDatabaseQuotaDefaults").Value,
Boolean) Then
MBXDefaults_chk.Checked = True
Else
Warning_tbox.Text =
Mailbox.Properties("IssueWarningQuota").Value.ToString
NoSend_tbox.Text =
Mailbox.Properties("ProhibitSendQuota").Value.ToString
NoSendRec_tbox.Text =
Mailbox.Properties("ProhibitSendReceiveQuota").Value.ToString
End If

Needless to say any help would be greatly appreciated.
 
M

Marco Shaw [MVP]

I remember something along the same lines, but can't find it in my archives.

It was relating to the fact that the dev system had been used to create an
application against a pre-release version of Exchange 2007, so it still had
older DLLs loaded. The older DLLs were getting the priority, and were
failing.

Have you used this system to develop on older versions of Exchange,
including your current one? That even includes changes in SPs...

Marco
 
T

Tim Munro

Yes, I do have ESM installed on this machine for Exchange 2003 as will the
target audience (until the migration is complete). That being the can I
reference the correct DLLs in the "References" section of the VB IDE? Also
why would it work OK from the EMS command line?
 
T

Tim Munro

Exchange 2003 and 2007 are in the same Organization running in mixed mode.
Once the migration is compete, 2003 will be decomissioned and 2007 will run
in native mode.

I'll try the forums you mentioned. Thanks Marco.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top