PowerShell Script Help issue

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of MichaelKF MichaelKF 6 months, 3 weeks ago.

  • Author
    Posts
  • #39153
    Profile photo of MichaelKF
    MichaelKF
    Participant

    Hi!

    I frequently use comment based help in PowerShell and it always worked fabulous. However, today I encountered an issue.

    If I use Get-Help Test.ps1 I get on some systems if the file is in some locations the following error, after "Searching for Help Test.ps1" popped up:

    Get-Help : Get-Help could not find Test.ps1 in a help file in this session. To download updated help topics type: "Update-Help". [...]

    The strange thing is: On my client, it doesn't work on local drives or one network share. But the help works for the very same file on another network share.
    But it is not only my client, I found at least one test server (plain Windows installation, no policies etc.) that has the same problem. Other servers I tried are working, no matter where the file is saved.

    By now, all I can say is, that the comment based help is functional and does not contain any syntax errors, otherwise it wouldn't work on any machine. Also: Execution of the scrip works always.
    So, do you have any idea why PowerShell is not able to parse the help as demanded?

  • #39164
    Profile photo of Arie H
    Arie H
    Participant

    Nothing comes directly in mind.
    Do you have similar issues with scripts that require specific modules to be present ?

    Can you look at each of those destinations, the $env:psmodulepath and the general Path environment variable for any visible differences ?

  • #39209
    Profile photo of MichaelKF
    MichaelKF
    Participant

    Path variables were different, but just as expected, nothing to do with the paths where Get-Help was working or not.

    So actually I just figured that issue out and in fact it was my own fault. 🙂 So, on one machine AppLocker Software Restriction policies are enabled and depending on the user context and path I was not able to execute the script and therefore the help was not working too. On the other machine I didn't have AppLocker enabled, but unfortunately I made a mistake in the script. I write a log file with the same name of the script during the runtime. I forgot to add an extension like .log, therefore the log was written directly in the PowerShell script. So I first executed the script successfully and tried the help after this. In the meanwhile my script was edited from its self which damaged the script and therefore the help. D'oh!

    Thanks,
    Michael

You must be logged in to reply to this topic.