I'm unable to run PowerShell help cmdlets after installing PowerCLI 6.5.1. More specifically, when modules "VMware.VimAutomation.Common" and "VMware.PowerCLI" are present in my user's Modules folder, get-help crashes with the following error:
get-help : Object reference not set to an instance of an object.
At line:1 char:1
+ get-help about_functions_advanced_parameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Help], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GetHelpCommand
PowerShell help works after I remove those two modules from the Modules folder.
To reproduce on my workstation,
Anyone else having this trouble?
PSVersion 5.0.10586.672 on Windows 10
To isolate to those two modules, I took the old MacOS extensions troubleshooting trick by removing modules in large groups until PowerShell help worked again. By remove, I mean I moved the module's folder outside my PSModulesPath. Then added them back in smaller groups till PowerShell Help broke again. Eventually got it down to just those two modules...both had to be removed from my modules folder for Help to work. Sanitized copy of my profile is attached too.
I'm happy to note that my workstation is now running Win10 version 1607. PSVersion is at 5.1.14393.206. And now I can use PowerShell Help while all the modules for PowerCLI 6.5.1 are installed. Yay!
So my problem seems to stem from the PowerShell 5.0 code present on Windows 10 version 1511.
What do you have in yoru PSModulePath?
Do a
$env:PSModulePath.Split(';')
Did you stop/start your PowerShell session after step 4?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
PSModulePath - ;C:\Users\HARMSG\Documents\WindowsPowerShell\Modules;C:\Program Files (x86)\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\PowerShell\Modules\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules\
Once PowerCLI 6.5.1 modules are available in my PSModulePath, this issue appears in existing PowerShell sessions and new ones.
The error is very much like an error posted to UserVoice
Get-Help cmdlet fails to show about topics when invalid module is installed – Windows Server
I'm using an enterprise-controlled version of Windows 10. It's still build 1511 (might see 1607 in late summer...). Since 1511 was first released prior to the post about the "fix" on the insiders build, I suspect I'm running into that bug because my workstation hasn't been allowed to upgrade to a build with the fix yet.
Yes, looks like that bug.
Keep us informed on the outcome.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey Greg!
How did you determine that removing `vmware.vimautomation.common` and `vmware.powercli` were what was causing the issue?
Also, can you share your powershell profile? Just curious to see if I can reproduce the issue.
To isolate to those two modules, I took the old MacOS extensions troubleshooting trick by removing modules in large groups until PowerShell help worked again. By remove, I mean I moved the module's folder outside my PSModulesPath. Then added them back in smaller groups till PowerShell Help broke again. Eventually got it down to just those two modules...both had to be removed from my modules folder for Help to work. Sanitized copy of my profile is attached too.
I'm happy to note that my workstation is now running Win10 version 1607. PSVersion is at 5.1.14393.206. And now I can use PowerShell Help while all the modules for PowerCLI 6.5.1 are installed. Yay!
So my problem seems to stem from the PowerShell 5.0 code present on Windows 10 version 1511.