Home All Groups Group Topic Archive Search About

MapiExceptionLowLevelInitializationFailure in C# with powershell

Author
28 Apr 2009 1:23 PM
Mathias

Hi!

When I'm executing the powershell command Disable-Mailbox in c# i get this
exception:
MapiExceptionLowLevelInitializationFailure: Unable to load exrpc32.dll or
one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll, etc)

The mailbox is removed ok, butI get this exception.
If I run the exact command in powershell, everything runs fine without
exceptions.

I'm running the code on a Vista x32 machine agains a Exchange 2007 x64 server.

Some powershell commands runs ok withou exceptions, but with commands like
Disable-Mailbox I get this exception.

Does anyone have any clue why this is happening?

/Mathias
Author
28 Apr 2009 2:38 PM
SvenC
Hi Mathias,

> When I'm executing the powershell command Disable-Mailbox in c# i get this
> exception:
> MapiExceptionLowLevelInitializationFailure: Unable to load exrpc32.dll or
> one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll, etc)
>
> The mailbox is removed ok, butI get this exception.
> If I run the exact command in powershell, everything runs fine without
> exceptions.
>
> I'm running the code on a Vista x32 machine agains a Exchange 2007 x64
> server.

What happens when you run your code on the Exchange Server itself?

I suspect that you are using the 32-bit version of Exchange 2007 on your
Vista
box, right? Not sure if that is a supported environment. IIRC the 32-bit
version is
for testing only and unsupported.

Are you using the same service pack level as your Exchange Server?

--
SvenC
Are all your drivers up to date? click for free checkup

Author
29 Apr 2009 5:09 AM
Mathias
Hi!

I haven't tried to run the code on the production environment, but I will
test it.
This is as you say the 32bit version of Exchange 2007 on my Vista machine.
It is strange that the powershell command works on my client if I run it in
a powershell window. It is only when I run it through c# that this problem
occurs.
Serveral other powershell commands works ok through c#

I have the same path-level om my client as I have on the production server.

Any more ideas on what can cause this?

/Mathias

Show quoteHide quote
"SvenC" wrote:

> Hi Mathias,
>
> > When I'm executing the powershell command Disable-Mailbox in c# i get this
> > exception:
> > MapiExceptionLowLevelInitializationFailure: Unable to load exrpc32.dll or
> > one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll, etc)
> >
> > The mailbox is removed ok, butI get this exception.
> > If I run the exact command in powershell, everything runs fine without
> > exceptions.
> >
> > I'm running the code on a Vista x32 machine agains a Exchange 2007 x64
> > server.
>
> What happens when you run your code on the Exchange Server itself?
>
> I suspect that you are using the 32-bit version of Exchange 2007 on your
> Vista
> box, right? Not sure if that is a supported environment. IIRC the 32-bit
> version is
> for testing only and unsupported.
>
> Are you using the same service pack level as your Exchange Server?
>
> --
> SvenC
>
>
Author
29 Apr 2009 2:41 PM
Karl Mitschke
Hello Mathias,

Show quoteHide quote
> Hi!
>
> I haven't tried to run the code on the production environment, but I
> will
> test it.
> This is as you say the 32bit version of Exchange 2007 on my Vista
> machine.
> It is strange that the powershell command works on my client if I run
> it in
> a powershell window. It is only when I run it through c# that this
> problem
> occurs.
> Serveral other powershell commands works ok through c#
> I have the same path-level om my client as I have on the production
> server.
>
> Any more ideas on what can cause this?
>
> /Mathias
>
> "SvenC" wrote:
>
>> Hi Mathias,
>>
>>> When I'm executing the powershell command Disable-Mailbox in c# i
>>> get this
>>> exception:
>>> MapiExceptionLowLevelInitializationFailure: Unable to load
>>> exrpc32.dll or
>>> one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll,
>>> etc)
>>> The mailbox is removed ok, butI get this exception.
>>> If I run the exact command in powershell, everything runs fine
>>> without
>>> exceptions.
>>> I'm running the code on a Vista x32 machine agains a Exchange 2007
>>> x64 server.
>>>
>> What happens when you run your code on the Exchange Server itself?
>>
>> I suspect that you are using the 32-bit version of Exchange 2007 on
>> your
>> Vista
>> box, right? Not sure if that is a supported environment. IIRC the
>> 32-bit
>> version is
>> for testing only and unsupported.
>> Are you using the same service pack level as your Exchange Server?
>>
>> --
>> SvenC

I have ASP pages that run the Disable-Mailbox command via C# on a daily basis,
and this error does not occur.

Show us your code, and perhaps we can figure this out
Author
30 Apr 2009 5:03 AM
Mathias
Hi!

Here's my code:

RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
PSSnapInException snapInException = null;
PSSnapInInfo info =
rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out
snapInException);
Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig);
myRunSpace.Open();
Pipeline pipeLine = myRunSpace.CreatePipeline();
Command myCommand = new Command("Disable-Mailbox");
CommandParameter verbParam = new CommandParameter("Identity",username);
myCommand.Parameters.Add(verbParam);
verbParam = new CommandParameter("Confirm",false);
myCommand.Parameters.Add(verbParam);
pipeLine.Commands.Add(myCommand);
Collection<PSObject> commandResults = pipeLine.Invoke();


I have also tried to use script call:
Command("Disable-Mailbox -Identity " + username + " -Confirm:$false", true);

Any ideas?

/Mathias

Show quoteHide quote
"Karl Mitschke" wrote:

> Hello Mathias,
>
> > Hi!
> >
> > I haven't tried to run the code on the production environment, but I
> > will
> > test it.
> > This is as you say the 32bit version of Exchange 2007 on my Vista
> > machine.
> > It is strange that the powershell command works on my client if I run
> > it in
> > a powershell window. It is only when I run it through c# that this
> > problem
> > occurs.
> > Serveral other powershell commands works ok through c#
> > I have the same path-level om my client as I have on the production
> > server.
> >
> > Any more ideas on what can cause this?
> >
> > /Mathias
> >
> > "SvenC" wrote:
> >
> >> Hi Mathias,
> >>
> >>> When I'm executing the powershell command Disable-Mailbox in c# i
> >>> get this
> >>> exception:
> >>> MapiExceptionLowLevelInitializationFailure: Unable to load
> >>> exrpc32.dll or
> >>> one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll,
> >>> etc)
> >>> The mailbox is removed ok, butI get this exception.
> >>> If I run the exact command in powershell, everything runs fine
> >>> without
> >>> exceptions.
> >>> I'm running the code on a Vista x32 machine agains a Exchange 2007
> >>> x64 server.
> >>>
> >> What happens when you run your code on the Exchange Server itself?
> >>
> >> I suspect that you are using the 32-bit version of Exchange 2007 on
> >> your
> >> Vista
> >> box, right? Not sure if that is a supported environment. IIRC the
> >> 32-bit
> >> version is
> >> for testing only and unsupported.
> >> Are you using the same service pack level as your Exchange Server?
> >>
> >> --
> >> SvenC
>
> I have ASP pages that run the Disable-Mailbox command via C# on a daily basis,
> and this error does not occur.
>
> Show us your code, and perhaps we can figure this out
>
>
>
Author
21 May 2009 4:14 PM
Karl Mitschke
Hello Mathias,

Sorry to take so long.

Your code sample works flawlessly on my test bench (Exchange 2007 SP1 / RU7)

Karl

Show quoteHide quote
> Hi!
>
> Here's my code:
>
> RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
> PSSnapInException snapInException = null;
> PSSnapInInfo info =
> rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin",
> out
> snapInException);
> Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig);
> myRunSpace.Open();
> Pipeline pipeLine = myRunSpace.CreatePipeline();
> Command myCommand = new Command("Disable-Mailbox");
> CommandParameter verbParam = new
> CommandParameter("Identity",username);
> myCommand.Parameters.Add(verbParam);
> verbParam = new CommandParameter("Confirm",false);
> myCommand.Parameters.Add(verbParam);
> pipeLine.Commands.Add(myCommand);
> Collection<PSObject> commandResults = pipeLine.Invoke();
> I have also tried to use script call:
> Command("Disable-Mailbox -Identity " + username + " -Confirm:$false",
> true);
> Any ideas?
>
> /Mathias
>
> "Karl Mitschke" wrote:
>
>> Hello Mathias,
>>
>>> Hi!
>>>
>>> I haven't tried to run the code on the production environment, but I
>>> will
>>> test it.
>>> This is as you say the 32bit version of Exchange 2007 on my Vista
>>> machine.
>>> It is strange that the powershell command works on my client if I
>>> run
>>> it in
>>> a powershell window. It is only when I run it through c# that this
>>> problem
>>> occurs.
>>> Serveral other powershell commands works ok through c#
>>> I have the same path-level om my client as I have on the production
>>> server.
>>> Any more ideas on what can cause this?
>>>
>>> /Mathias
>>>
>>> "SvenC" wrote:
>>>
>>>> Hi Mathias,
>>>>
>>>>> When I'm executing the powershell command Disable-Mailbox in c# i
>>>>> get this
>>>>> exception:
>>>>> MapiExceptionLowLevelInitializationFailure: Unable to load
>>>>> exrpc32.dll or
>>>>> one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll,
>>>>> etc)
>>>>> The mailbox is removed ok, butI get this exception.
>>>>> If I run the exact command in powershell, everything runs fine
>>>>> without
>>>>> exceptions.
>>>>> I'm running the code on a Vista x32 machine agains a Exchange 2007
>>>>> x64 server.
>>>> What happens when you run your code on the Exchange Server itself?
>>>>
>>>> I suspect that you are using the 32-bit version of Exchange 2007 on
>>>> your
>>>> Vista
>>>> box, right? Not sure if that is a supported environment. IIRC the
>>>> 32-bit
>>>> version is
>>>> for testing only and unsupported.
>>>> Are you using the same service pack level as your Exchange Server?
>>>> --
>>>> SvenC
>> I have ASP pages that run the Disable-Mailbox command via C# on a
>> daily basis, and this error does not occur.
>>
>> Show us your code, and perhaps we can figure this out
>>
Author
21 May 2009 4:26 PM
Karl Mitschke
Hello Mathias,

That is, I ran it on my mailbox server (Server 2k3, 64bit)

I will try in XP 32 bit, once I install the Exchange Management tools.

Karl

Show quoteHide quote
> Hello Mathias,
>
> Sorry to take so long.
>
> Your code sample works flawlessly on my test bench (Exchange 2007 SP1
> / RU7)
>
> Karl
>
>> Hi!
>>
>> Here's my code:
>>
>> RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
>> PSSnapInException snapInException = null;
>> PSSnapInInfo info =
>> rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin"
>> ,
>> out
>> snapInException);
>> Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig);
>> myRunSpace.Open();
>> Pipeline pipeLine = myRunSpace.CreatePipeline();
>> Command myCommand = new Command("Disable-Mailbox");
>> CommandParameter verbParam = new
>> CommandParameter("Identity",username);
>> myCommand.Parameters.Add(verbParam);
>> verbParam = new CommandParameter("Confirm",false);
>> myCommand.Parameters.Add(verbParam);
>> pipeLine.Commands.Add(myCommand);
>> Collection<PSObject> commandResults = pipeLine.Invoke();
>> I have also tried to use script call:
>> Command("Disable-Mailbox -Identity " + username + " -Confirm:$false",
>> true);
>> Any ideas?
>> /Mathias
>>
>> "Karl Mitschke" wrote:
>>
>>> Hello Mathias,
>>>
>>>> Hi!
>>>>
>>>> I haven't tried to run the code on the production environment, but
>>>> I
>>>> will
>>>> test it.
>>>> This is as you say the 32bit version of Exchange 2007 on my Vista
>>>> machine.
>>>> It is strange that the powershell command works on my client if I
>>>> run
>>>> it in
>>>> a powershell window. It is only when I run it through c# that this
>>>> problem
>>>> occurs.
>>>> Serveral other powershell commands works ok through c#
>>>> I have the same path-level om my client as I have on the production
>>>> server.
>>>> Any more ideas on what can cause this?
>>>> /Mathias
>>>>
>>>> "SvenC" wrote:
>>>>
>>>>> Hi Mathias,
>>>>>
>>>>>> When I'm executing the powershell command Disable-Mailbox in c# i
>>>>>> get this
>>>>>> exception:
>>>>>> MapiExceptionLowLevelInitializationFailure: Unable to load
>>>>>> exrpc32.dll or
>>>>>> one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll,
>>>>>> etc)
>>>>>> The mailbox is removed ok, butI get this exception.
>>>>>> If I run the exact command in powershell, everything runs fine
>>>>>> without
>>>>>> exceptions.
>>>>>> I'm running the code on a Vista x32 machine agains a Exchange
>>>>>> 2007
>>>>>> x64 server.
>>>>> What happens when you run your code on the Exchange Server itself?
>>>>>
>>>>> I suspect that you are using the 32-bit version of Exchange 2007
>>>>> on
>>>>> your
>>>>> Vista
>>>>> box, right? Not sure if that is a supported environment. IIRC the
>>>>> 32-bit
>>>>> version is
>>>>> for testing only and unsupported.
>>>>> Are you using the same service pack level as your Exchange Server?
>>>>> --
>>>>> SvenC
>>> I have ASP pages that run the Disable-Mailbox command via C# on a
>>> daily basis, and this error does not occur.
>>>
>>> Show us your code, and perhaps we can figure this out
>>>
Author
21 May 2009 5:19 PM
Karl Mitschke
Hello Mathias

I have verified that this code works fine on my Windows XP x86 box.

Karl

Show quoteHide quote
> Hello Mathias,
>
> That is, I ran it on my mailbox server (Server 2k3, 64bit)
>
> I will try in XP 32 bit, once I install the Exchange Management tools.
>
> Karl
>
>> Hello Mathias,
>>
>> Sorry to take so long.
>>
>> Your code sample works flawlessly on my test bench (Exchange 2007 SP1
>> / RU7)
>>
>> Karl
>>
>>> Hi!
>>>
>>> Here's my code:
>>>
>>> RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
>>> PSSnapInException snapInException = null;
>>> PSSnapInInfo info =
>>> rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin
>>> "
>>> ,
>>> out
>>> snapInException);
>>> Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig);
>>> myRunSpace.Open();
>>> Pipeline pipeLine = myRunSpace.CreatePipeline();
>>> Command myCommand = new Command("Disable-Mailbox");
>>> CommandParameter verbParam = new
>>> CommandParameter("Identity",username);
>>> myCommand.Parameters.Add(verbParam);
>>> verbParam = new CommandParameter("Confirm",false);
>>> myCommand.Parameters.Add(verbParam);
>>> pipeLine.Commands.Add(myCommand);
>>> Collection<PSObject> commandResults = pipeLine.Invoke();
>>> I have also tried to use script call:
>>> Command("Disable-Mailbox -Identity " + username + "
>>> -Confirm:$false",
>>> true);
>>> Any ideas?
>>> /Mathias
>>> "Karl Mitschke" wrote:
>>>
>>>> Hello Mathias,
>>>>
>>>>> Hi!
>>>>>
>>>>> I haven't tried to run the code on the production environment, but
>>>>> I
>>>>> will
>>>>> test it.
>>>>> This is as you say the 32bit version of Exchange 2007 on my Vista
>>>>> machine.
>>>>> It is strange that the powershell command works on my client if I
>>>>> run
>>>>> it in
>>>>> a powershell window. It is only when I run it through c# that this
>>>>> problem
>>>>> occurs.
>>>>> Serveral other powershell commands works ok through c#
>>>>> I have the same path-level om my client as I have on the
>>>>> production
>>>>> server.
>>>>> Any more ideas on what can cause this?
>>>>> /Mathias
>>>>> "SvenC" wrote:
>>>>>
>>>>>> Hi Mathias,
>>>>>>
>>>>>>> When I'm executing the powershell command Disable-Mailbox in c#
>>>>>>> i
>>>>>>> get this
>>>>>>> exception:
>>>>>>> MapiExceptionLowLevelInitializationFailure: Unable to load
>>>>>>> exrpc32.dll or
>>>>>>> one of its dependent DLLs (extrace.dll, exchmem.dll,
>>>>>>> msvcr80.dll,
>>>>>>> etc)
>>>>>>> The mailbox is removed ok, butI get this exception.
>>>>>>> If I run the exact command in powershell, everything runs fine
>>>>>>> without
>>>>>>> exceptions.
>>>>>>> I'm running the code on a Vista x32 machine agains a Exchange
>>>>>>> 2007
>>>>>>> x64 server.
>>>>>> What happens when you run your code on the Exchange Server
>>>>>> itself?
>>>>>>
>>>>>> I suspect that you are using the 32-bit version of Exchange 2007
>>>>>> on
>>>>>> your
>>>>>> Vista
>>>>>> box, right? Not sure if that is a supported environment. IIRC the
>>>>>> 32-bit
>>>>>> version is
>>>>>> for testing only and unsupported.
>>>>>> Are you using the same service pack level as your Exchange
>>>>>> Server?
>>>>>> --
>>>>>> SvenC
>>>> I have ASP pages that run the Disable-Mailbox command via C# on a
>>>> daily basis, and this error does not occur.
>>>>
>>>> Show us your code, and perhaps we can figure this out
>>>>

Bookmark and Share