Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell: "Get-Help Cannot find Help for topic" error with script Comment_Based_Help

Trying to retrieve help from a script gives the following error:

Get-Help : Cannot find Help for topic ".\Process-Test.ps1".
At line:1 char:9
+ get-help <<<<  .\Process-Test.ps1
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

I've encountered the same error when attempting to retrieve help information from any custom PowerShell script. This does not happen when viewing help information from built-in cmdlets.

A test script is below:

<#
    .SYNOPSIS 
    Adds a file name extension to a supplied name.

    .DESCRIPTION
    Adds a file name extension to a supplied name. 
    Takes any strings for the file name or extension.

    .EXAMPLE
    C:\PS> extension -name "File"
    File.txt
#>

Write-Host "Test script"

Troubleshooting steps I've taken:

  • I've copied this script (or similar scripts) to other machines with PowerShell installed and used it to view help successfully.
  • I've also been able to view the help using a different account (User2) on my computer successfully, but only when logged in as the other user (versus running the PowerShell console as User2 when logged in as User1).
  • I've tried viewing the help with and without my PowerShell profile loaded, with the same result (I only have one profile loaded, my personal profile versus machine profiles).
  • I took this to be a sign that there was a problem with my Windows user profile, so I deleted my profile and re-created it with the same result. I've also tried running System Restore, with no change.
  • This happens in the PowerShell console along with the ISE.
  • Occurs when using both Get-Help as well as help.

I noticed, however, that my PowerShell console settings stayed consistent throughout deleting and re-creating my Windows user profile (height, width, colors, etc), which I wouldn't have expected since I deleted my user profile.

Since I'm using Windows 7, I'm not able to uninstall PowerShell and re-install as it's baked into the OS.

Google wasn't helpful for me in this case, but my google skills could be lacking. Any ideas as to further troubleshooting steps, or anyone who's seen this error before?

Edit: this only happens with the 64-bit version of the console and ISE, not with the 32-bit version, and persists through profile deletion

like image 216
Cory Plastek Avatar asked Jan 15 '12 06:01

Cory Plastek


2 Answers

Have you tried to set execution policy?

Set-ExecutionPolicy -ExecutionPolicy remotesigned -Scope process

Then do Get-Help .\script.ps1.

like image 135
knut Avatar answered Nov 16 '22 00:11

knut


I had the same problem. That was because my script was located on a networkshare in a DFS folder. So I am pointing to network file. When I copied the file locally, directly on the root of my C drive, and called the help option for my script with the normal get-help myscript.ps1 parameter, it worked!

like image 2
StephaneVg Avatar answered Nov 16 '22 01:11

StephaneVg