Author Posts

February 1, 2016 at 2:19 pm

I'm having a weird issue with the Get-Help cmdlet on my computer. Whenever I want to view the help for an about topic, I get a NullRefernceException:


> $Error[0] | fl * -force


PSMessageDetails      :
Exception             : System.NullReferenceException: Object reference not set to an instance of an object.
                           at System.Management.Automation.AnalysisCache.GetExportedClasses(String modulePath, ExecutionContext context)
                           at System.Management.Automation.PSClassSearcher.FindTypeByModulePath(WildcardPattern classNameMatcher)
                           at System.Management.Automation.PSClassSearcher.GetNextClass()
                           at System.Management.Automation.PSClassHelpProvider.d__17.MoveNext()
                           at System.Management.Automation.PSClassHelpProvider.d__e.MoveNext()
                           at System.Management.Automation.HelpSystem.d__b.MoveNext()
                           at System.Management.Automation.HelpSystem.d__0.MoveNext()
                           at Microsoft.PowerShell.Commands.GetHelpCommand.ProcessRecord()
                           at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject          :
CategoryInfo          : NotSpecified: (:) [Get-Help], NullReferenceException
FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GetHelpCommand
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at , : line 1
PipelineIterationInfo : {}

Is this a known issue? Has anyone encountered this before?

PowerShell 5/Windows 7


> $PSVersionTable

Name                           Value                                                                                                                                                                                                                                      
----                           -----                                                                                                                                                                                                                                      
PSVersion                      5.0.10586.51                                                                                                                                                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                                    
BuildVersion                   10.0.10586.51                                                                                                                                                                                                                              
CLRVersion                     4.0.30319.34209                                                                                                                                                                                                                            
WSManStackVersion              3.0                                                                                                                                                                                                                                        
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                                        
SerializationVersion           1.1.0.1

February 1, 2016 at 2:24 pm

Let's quickly confirm that you have no profile script, or that you're opening the shell using the switch to suppress profile loading. Also, is this in the console, the ISE, or both? And, has Update-Help been run recently?

February 1, 2016 at 3:56 pm

It happens in both the ISE and console. The same thing happens when I suppress profile loading. I get the same error when I run Update-Help.

February 1, 2016 at 3:58 pm

Since the problem was only with about topics, I figured the problem was with PowerShell looking through all the modules for about help topics. I slowly deleted/uninstalled modules one at a time to see if one of the modules was affecting this.

It turns out I had a strange module with a GUID for a name and an empty .psd1 file. Not sure where this came from, but I imagine from some automated test that didn't properly clean up after itself.

Once I deleted this "empty" module, Get-Help and Update-Help worked again.

February 1, 2016 at 4:05 pm

You should bug that on PowerShell's UserVoice page, including all the details you can since it's replicable. The system should fail a little more gracefully than bombing the entire help functionality.

June 5, 2017 at 10:47 pm

I ran into this behavior today.

It was caused by PowerCLI, the VMWare module.

I uninstalled and all is back to normal.

September 14, 2017 at 11:59 am

Marty, you are the man! I've been applying my forehead to the top of my desk for hours (not recommended) trying to figure out what the problem was and was stuck. Removing PowerCLI did the trick. Thank you so much. This solved several issues I was running into running various "help" commands.