none
Move-MailBox error in Exchange 2007 RRS feed

  • Question

  •  

    Hi All,

     

    I have implemented the move mailbox feature using the c# interop com component in Visual studio 2005 for Exchange 2007 server. The same functionality works perfectly with the Exchange Management Console and Exchange Management Shell.

     

    But iam getting an error as below:

     

     

    Message :- [System.Management.Automation.CmdletInvocationException]{"Retrieving the COM class factory for component with CLSID {08D1AA55-704E-4397-AB29-55D2A3972BCB} failed due to the following error: 8007007f.}
    Stack Trace :-
        at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
       at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecute(Array input, Hashtable errorResults)
       at System.Management.Automation.Internal.PipelineProcessor.Execute(Array input)
       at System.Management.Automation.Internal.PipelineProcessor.Execute()
       at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
       at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
    Source : System.Management.Automation

     

    Any one have any solution for this.

    Please try to post the solutuion asap.

    Tuesday, May 22, 2007 2:10 PM

All replies

  • Hi suraj,

     

    Maybe i can help you or try to, but what interop com component you're using to code for Exchange 2007 ?

     

    You're using the System.Management.Automation.dll that is available on Windows(Powershell) SDK ?

    Tuesday, May 22, 2007 2:40 PM
  • Hi Fernando

     

    Ya thanks for reply......

     

    Actually iam using a VB client and i have made the component in c#.NET 2005 which i register as interop com by checking the option in project settings.

    Yes you are right iam using the System.Management.Automation namespace in my project as it is the only way to do all the exchange management related operations in exchange 2007.

     

    The problem is that when i try to invoke the component through my VB client code it give s me the above mentioned error.

    But if i try a seperate small VB project exe it works fine.

     

     

    I have a doubt that since the c# interop component uses internally the System.Management.Automation  dll which is a .NET assembly. So is it possible that the unmamnaged code in my VB code is not able to acccess the managed .NET  System.Management.Automation  assembly

     

    I would really appreciate if you could help me in this case.

     

    Thanks & Regards

    Suraj Bagad

     

     

    Friday, May 25, 2007 12:12 PM
  • Ok...

    I still don't see what COM assembly you're using, but for a mailbox-move you should only need the System.Management.Automation namespace and something like:

     

    Command objCmd = new Command("Move-Mailbox");

    objCmd.Parameters.Add("Identity", "user@domain");

    objCmd.Parameters.Add("TargetDatabase", "exchangeserver\mailboxstore");

    objCmd.Parameters.Add("Confirm", "$False");

     

    pipeLine.Commands.Add(objCmd);

    results = pipeLine.Invoke();

     

    The database parameter should be in the form of: exchangeserver\mailboxstore

    The syntax is C#, but you should get it.

    Friday, May 25, 2007 11:09 PM
  • HI Fernando

     

    You are absolutely right and i have coded the same way in c#.

    It is working fine also when i run it through normal vb client i.e a VB exe application.

    But when i try to invoke it through my products VB client code(which is a dll) it throws the error.

     

    Thanks Regards

     

    Suraj
    Monday, May 28, 2007 2:23 PM
  • Ok, you coded a C# Class Library and registered it as a COM Object..

    You're using VB 6 to call your "COM Object"... when using a .exe it runs fine, when using a dll it generates the error, right ?

     

    I've only needed to make a ".NET COM Object" once for use on a legacy ASP page and fortunatly never had any issues.

     

    But i've checked and the Class ID that the error reports ({08D1AA55-704E-4397-AB29-55D2A3972BCB}) its the Move-Mailbox  of migbase.dll of Exchange 2007.

    That sounds more like an "Interop and CLR interactions" issue than with anything related speciffically to the Exchange API (unless you got really unlucky and something is screwed with the Automation namespace/migbase.dll).

     

    Try posting your problem on Visual C# language forum, focusing on the components interactions and not specifically about Exchange.

    http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=59

    Tuesday, May 29, 2007 12:10 AM
  • i am also seeing the same error.

    btw what do you mean when you say

    exchangeserver\mailboxstore

    Dont we need to mention the storage group?

    Dont we need to mention the DN of the store?

     

     

    Tuesday, June 5, 2007 9:59 AM
  • Well, you're right, you should use:

     

    ExchangeServer\StorageGroup\MailboxStore

    Tuesday, June 5, 2007 3:57 PM
  • I have an issue that may be similar

     

    I try to run the Move-Mailbox command for a specific user in the Exchange Management Shell and the shell crashes.  Now the interesting thing is that this same command works for all other mailboxes. So I check the event log and see a .NET Runtime 2.0 Error " Faulting application powershell.exe....faulting module migbase.dll...".  This is an Exchange 2003 to Exchange 2007 Cross Org migration.

     

     

     

     

    Tuesday, December 11, 2007 11:20 PM