A utility to export/import/create MSMQ Queues, Triggers and Rules

Also Check Out: My latest venture. http://loqly.me – a way for you to ask questions and get answers about local businesses around you. iTunes link: http://bit.ly/e5u4jv (only available in US for now)


MSMQ Export /Migration Utility

input.jpgmsmqexport 2.0 – I have updated the link after lot of people complained that the last link wasn’t accessible.

screenshot.JPG

I developed this utility to migrate all the MSMQs from one server to another. I have used MSMQ and “Trigger Service” COM objects to create message queues/triggers/rules.
According to my discussion with MS support guy, he wasn’t aware of any way to create triggers and rules programatically. So, if you are looking to do this, this will prove to be a great tool.

Possible uses :

1. Migrate all queues/triggers/rules from one server to another.

2. Use as a backup /restore tool.

3. use it to recreate production environment on a test server.

4. Use it to migrate servers.

Email me if you have any questions or want changes/modifications to the tool ashuREMOVETHIS.pant@gmail.com

32 thoughts on “A utility to export/import/create MSMQ Queues, Triggers and Rules

  1. Does this work for private queues? I have admin rights on both the machine and the queues but nothing shows up in the listbox on the right after “GetQueues”.

  2. Thanks for bringing that up. But the tool only works for public queues as of now. I will have to change it a little bit for private queues. Will update the utility once I find time to make that change.

  3. On Popular demand, I have changed the utility and now it will allow you to handle Private Queues as well.

    Ver 1.0 of this tool is still available for download.

  4. Hello,

    Thanks for the utlity. When I run it it displays all the queues. But when I try to export it it throws following exception.

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
    at WindowsApplication1.CTriggers..ctor(String sMachineName, Boolean bClustered)
    at WindowsApplication1.Form1.cmdExport_Click(Object sender, EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Please advise.

    Thanks

    Anil Suri

  5. Anil,

    Looks like an I/O permission issue. It is throwing an exception on the export button click. Are you sure you have permissions on the folder where you are running it from. eg. if u copied it on a network folder and run it from there, maybe it is failing while trying to create the file

    • Yes, I get exactly the same error, I’m able to see the queues but can’t export them.

      Did you find a way to export queues?

      • I created my own tool using .net after waiting for this guy to reply.If you still need a tool i will be able to email it to you if you want.

        –vamsi

  6. I am trying to use this utility to export private queue from one server to another. When I click export button it throws following exception. I was logged on as an administrator.

    ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
    at WindowsApplication1.CTriggers..ctor(String sMachineName, Boolean bClustered)
    at WindowsApplication1.Form1.cmdExport_Click(Object sender, EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2407
    CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
    —————————————-
    MSMQExport
    Assembly Version: 1.0.2649.18587
    Win32 Version: 1.0.2649.18587
    CodeBase: file:///D:/msmq/MSMQExport.exe
    —————————————-
    System.Windows.Forms
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2365
    CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
    —————————————-
    System
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2407
    CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
    —————————————-
    System.Drawing
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2327
    CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
    —————————————-
    Accessibility
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
    —————————————-
    Microsoft.VisualBasic
    Assembly Version: 7.0.5000.0
    Win32 Version: 7.10.6310.4
    CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
    —————————————-
    System.Data
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2365
    CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
    —————————————-
    System.Xml
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2371
    CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
    —————————————-
    System.Management
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system.management/1.0.5000.0__b03f5f7f11d50a3a/system.management.dll
    —————————————-
    System.Messaging
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2366
    CodeBase: file:///c:/windows/assembly/gac/system.messaging/1.0.5000.0__b03f5f7f11d50a3a/system.messaging.dll
    —————————————-

  7. I get the same error as Pratibha got and i have full permission on the folder for everyone.Whats wrong here.Nihanth can you advice.Do i need to register the
    Interop.MSMQTriggerObjects.dll and the Interop.MSMQ.dll’s to gac or to registry.Please reply what needs to be done.

    • I created my own tool using .net after waiting for this guy to reply.If you still need a tool i will be able to email it to you if you want.

      –vamsi

      • Vamsi,
        It’s been 1.5 years since you posted this, but if you have this tool still available I could REALLY use your assistance. Thanks!

  8. Program has errors on Windows 7 (export file dialog doesn’t show up and cannot “get queues” unless “only private Qs” is selected.

    • I havent figure this out yet. It happens on all machines. I think you will have to use CASPOL to give it access to your machine. By default .net security is not giving it access to read the file system that is why it blows up.

  9. Not able to download it giving error “— 403: Access Denied —

    This file requires authorization:

    You must both be a user of this blog as well as be currently logged into WordPress.com”

  10. Not able to download it giving error “— 403: Access Denied —
    This file requires authorization:
    You must both be a user of this blog as well as be currently logged into WordPress.com”

  11. Not able to download it giving error “— 403: Access Denied —
    This file requires authorization:
    You must both be a user of this blog as well as be currently logged into WordPress.com”

  12. I know this is a year after the latest post, but I was really hoping to get this tool working. Looks like the download available here is good, but when exporting there is a code error:

    ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
    at WindowsApplication1.CTriggers..ctor(String sMachineName, Boolean bClustered)
    at WindowsApplication1.Form1.cmdExport_Click(Object sender, EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Any resolve to this?

  13. Oh my goodness! Awesome article dude! Many thanks, However I am
    experiencing difficulties with your RSS. I don’t know why I cannot join it. Is there anyone else getting similar RSS issues? Anyone who knows the answer can you kindly respond? Thanks!!

Leave a reply to Nishant Pant Cancel reply