PowerGUI Editor 2.1.1 and AD cmdlets 1.4 compatibility issue

[UPDATE] This issue got fixed in PowerGUI 2.2.

We have found that in some cases when you are using version 1.4.0 of QAD cmdlets inside PowerGUI Script Editor 2.1.1, and invoke a script with the cmdlets for the second time you may get the error: “Object reference not set to an instance of an object.

This is obviously very unfortunate and we are working on fixing the issue. In the meantime there are a couple of workarounds you can use:

A. Run Script Editor in MTA mode (if you don’t know what STA/MTA mean – this means that you would likely not notice any difference – but as a side-effect it might affect some script editor add-ons or your scripts using WPF)

To do this, just modify the PowerGUI Script Editor shortcut:

and add the -MTA switch to the command line:

B. Alternatively, you can set PowerGUI Script Editor to reset PowerShell runspace each time you start debugging:

1. In PowerGUI Script Editor, on the Tools menu, click Options,

2. In Debug Options, select Reset PowerShell runspace each time debugging is started.

Again, we appologise for the inconvenience and are working on a perminent fix.


6 Responses to “PowerGUI Editor 2.1.1 and AD cmdlets 1.4 compatibility issue”

  1. 1 Henning August 20, 2010 at 4:22 pm

    I tried alternative B … but without success. Whenever I run Get-ADObject the second time I get the “Object reference not set to an instance” exception.

  2. 2 Rene March 8, 2011 at 2:46 pm

    I’am using Powergui V2.4.0.1659 and still have the problem.
    Setting the debug option doesn’t work.

    • 3 Dmitry Sotnikov March 8, 2011 at 5:33 pm


      Thanks for bringing this up. Looks like we do indeed have an issue.

      Could you try to:
      1. Go to Tools / Options / Debug Options,
      2. Set the “Run all scripts in the same runspace” option (I know that this is the opposite of what the above post recommends ;)),
      3. Restart PowerGUI Script Editor.

      Has this fixed the issue?


      • 4 Rene March 9, 2011 at 6:33 am


        I have two working options:
        1. -MTA switch
        2. Set “Runs all scripts in the same runspace”.

        The the option “Reset Powershell runspace each time debugging is started” still give the error:
        “Get-QADUser : Object reference not set to an instance of an object.”


  3. 5 Dmitry Sotnikov March 9, 2011 at 5:46 pm


    Yes, “Reset Powershell runspace each time debugging is started” does not work – looks like QAD cmdlets 1.4 do not re-initialize properly – so please stick with the other option for now.

    Thanks for reporting the issue. We will be fixing it in future versions.


    • 6 Lubrano di ciccone May 20, 2011 at 9:18 am

      I fighted with that issue, did a trace using procmon etc… & found that it may be related to many stuff. Then I end up by deleting the user profile. (just take care to save the needed elements before).
      Stupid issue Solved in my case.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

My Recent Tweets


The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

July 2010

%d bloggers like this: