[UPDATE] This issue has been fixed in AD cmdlets 1.5.1 – please download the latest version of AD cmdlets here.
We have found a compatibility issue between PowerGUI Script Editor 2.4 and AD cmdlets 1.4 (these are the current versions at the time I am writing this post.)
You execute a script which is using QAD cmdlets. The first time the script executes fine. However when you try to execute it again, the script fails with the “
Object reference not set to an instance of an object.” error.
The issue is related to the way QAD cmdlets are handling initialization and unloading of the snapin.
Set PowerGUI Script Editor to not reset PowerShell runspaces between the debug sessions:
1. Go to Tools / Options / Debug Options,
2. Select the
Run all scripts in the same runspace option.
3. Restart PowerGUI Script Editor.
We are sorry for the inconvenience and are working on fixing the issue in the next releases.