Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with PSCX and Quest AD Cmdlets

7 views
Skip to first unread message

Kuma

unread,
Jul 16, 2008, 10:44:50 PM7/16/08
to
Has anyone else run into the following problem? I downloaded v1.1 of
Quests ActiveRoles ADManagement Cmdlets, I am also running PowerGUI
1.5.0.434 and PSCX v1.1.1. I uninstalled the Quest AD cmdlets,
launched powershell, ran get-pssnapin -registered to verify it was
gone, exited powershell, then installed the new version. I added a Add-
PsSnapin Quest.ActiveRoles.ADManagement line to my profile and
launched powershell. Powershell promptly spit out an unhandled
exception and exited on me. I removed the line from my profile and all
was again happy. If i run Get-PSSnapin -Registered I see the
Quest.ActiveRoles.ADManagement snapin installed. I can then Add-
Pssnapin Quest.ActiveRoles.ADManagement and all is still happy. My
question is why wouldn't it load from my profile?

I did some more digging around and discovered the stack trace for
the error:

An error has occurred that was not properly handled. Additional
information is shown below. The Windows PowerShell procss will exit.

Unhandled Exception: System.NullReferenceException: Object reference
not set to an instance of an object.
at Pscx.Commands.TabExpansion.Caches.TypeNameCache.Node.Add(Type
type)
at Pscx.Commands.TabExpansion.Caches.TypeNameCache.OnInitialize()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutcode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Objectstate)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

I noticed the tabexpansion so I moved the Add-PsSnapin
Quest.ActiveRoles.ADManagement line in my profile below the Start-
TabExpansion line, this gave me my happiness back as everything loaded
correctly. If i put it above the Start-TabExpansion line again it
crashes powershell. Manually adding the snapin and running start-
tabexpansion from the powershell command line works however. PowerGUI
doesn't care where it is and loads with no issues at all. Can anyone
explain why this is happening?

Shay Levy [MVP]

unread,
Jul 17, 2008, 5:29:57 AM7/17/08
to
Hi Kuma,

I can't explain why this is happening but it has been reported with regard
to Pscx and PrimalScript:
http://www.codeplex.com/PowerShellCX/Thread/View.aspx?ThreadId=12645&ANCHOR#Post104200


---
Shay Levy
Windows PowerShell MVP
blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic

K> Has anyone else run into the following problem? I downloaded v1.1 of
K> Quests ActiveRoles ADManagement Cmdlets, I am also running PowerGUI
K> 1.5.0.434 and PSCX v1.1.1. I uninstalled the Quest AD cmdlets,
K> launched powershell, ran get-pssnapin -registered to verify it was
K> gone, exited powershell, then installed the new version. I added a
K> Add-
K> PsSnapin Quest.ActiveRoles.ADManagement line to my profile and
K> launched powershell. Powershell promptly spit out an unhandled
K> exception and exited on me. I removed the line from my profile and
K> all
K> was again happy. If i run Get-PSSnapin -Registered I see the
K> Quest.ActiveRoles.ADManagement snapin installed. I can then Add-
K> Pssnapin Quest.ActiveRoles.ADManagement and all is still happy. My
K> question is why wouldn't it load from my profile?
K> I did some more digging around and discovered the stack trace for
K> the error:
K>
K> An error has occurred that was not properly handled. Additional
K> information is shown below. The Windows PowerShell procss will exit.
K>
K> Unhandled Exception: System.NullReferenceException: Object reference
K> not set to an instance of an object.
K> at Pscx.Commands.TabExpansion.Caches.TypeNameCache.Node.Add(Type
K> type)
K> at Pscx.Commands.TabExpansion.Caches.TypeNameCache.OnInitialize()
K> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
K> at System.Threading.ExecutionContext.runTryCode(Object userData)
K> at
K> System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuarant
K> eedCleanup(TryCode
K> code, CleanupCode backoutcode, Object userData)
K> at System.Threading.ExecutionContext.RunInternal(ExecutionContext
K> executionContext, ContextCallback callback, Objectstate)
K> at System.Threading.ExecutionContext.Run(ExecutionContext
K> executionContext, ContextCallback callback, Object state)
K> at System.Threading.ThreadHelper.ThreadStart()
K> I noticed the tabexpansion so I moved the Add-PsSnapin
K> Quest.ActiveRoles.ADManagement line in my profile below the Start-
K> TabExpansion line, this gave me my happiness back as everything
K> loaded correctly. If i put it above the Start-TabExpansion line again
K> it crashes powershell. Manually adding the snapin and running start-
K> tabexpansion from the powershell command line works however.
K> PowerGUI doesn't care where it is and loads with no issues at all.
K> Can anyone explain why this is happening?
K>


Oisin (x0n) Grehan [MVP]

unread,
Jul 19, 2008, 9:20:32 AM7/19/08
to
> System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCle­anup(TryCode

> code, CleanupCode backoutcode, Object userData)
>    at System.Threading.ExecutionContext.RunInternal(ExecutionContext
> executionContext, ContextCallback callback, Objectstate)
>    at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>    at System.Threading.ThreadHelper.ThreadStart()
>
> I noticed the tabexpansion so I moved the Add-PsSnapin
> Quest.ActiveRoles.ADManagement line in my profile below the Start-
> TabExpansion line, this gave me my happiness back as everything loaded
> correctly. If i put it above the Start-TabExpansion line again it
> crashes powershell. Manually adding the snapin and running start-
> tabexpansion from the powershell command line works however.  PowerGUI
> doesn't care where it is and loads with no issues at all. Can anyone
> explain why this is happening?

Hi,

This bug is fixed in the upcoming Pscx 1.2. It is caused by our tab
expansion code assuming that that all types have a namespace. MoW's
PowerTab is a much better solution than what we're offering, so I
suggest you comment out the start-tabexpansion line with a '#' and get
PowerTab instead.

http://thepowershellguy.com/blogs/posh/pages/powertab.aspx

- Oisin

Kuma

unread,
Jul 19, 2008, 9:44:28 AM7/19/08
to
On Jul 19, 10:20 pm, "Oisin (x0n) Grehan [MVP]" <ois...@gmail.com>
wrote:
> - Oisin- Hide quoted text -
>
> - Show quoted text -

Works great thanks for the tip.

0 new messages