VMware Cloud Community
feixfb
Contributor
Contributor

Use Command Based Help in Scripts

Hi,

i try to update my Scripts with a Script help which are located in the script it self.

I found a Howto: Add help to your own PowerShell scripts 

Buit if i copy the script and try it by my self ot will produce an error:

get-help : .\hello_world.ps1 wurde in einer Hilfedatei in dieser Sitzung von Get-Help nicht gefunden. Zum Herunterladen

von aktualisierten Hilfethemen geben Sie Folgendes ein: "Update-Help". Wenn Sie Hilfe online abrufen möchten, suchen Sie

in der TechNet-Bibliothek unter "https:/go.microsoft.com/fwlink/?LinkID=107116" nach dem Hilfethema.

In Zeile:1 Zeichen:1

+ get-help .\hello_world.ps1

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException

    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Has sombody an idea what i do wrong?

Greetings

feix

Reply
0 Kudos
10 Replies
LucD
Leadership
Leadership

If you copy that text in a .ps1 file (sample attached), you shluld be able to do a Get-Help on the script.

help.jpg

Attach your script, so we can have a look.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
feixfb
Contributor
Contributor

ss.PNG

Reply
0 Kudos
LucD
Leadership
Leadership

Which PowerShell version are you using, check what $PSVersionTable says.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
feixfb
Contributor
Contributor

Name                           Value

----                           -----

PSVersion                      5.1.16299.15

PSEdition                      Desktop

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

BuildVersion                   10.0.16299.15

CLRVersion                     4.0.30319.42000

WSManStackVersion              3.0

PSRemotingProtocolVersion      2.3

SerializationVersion           1.1.0.1

Reply
0 Kudos
LucD
Leadership
Leadership

But wait, your file works perfectly for me.

Looks like the error you are getting translates into a f not found error.

Are you sure the file is located in the directory where you are located?

Does a Get-ChildItem from the PS prompt show the file?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
feixfb
Contributor
Contributor

Yes

PS Z:\Eigene Dateien\Dokumente\git\vmware\vmware Powershell\Allgemein> Get-ChildItem .\hello_world.ps1

    Verzeichnis: Z:\Eigene Dateien\Dokumente\git\vmware\vmware Powershell\Allgemein

Mode                LastWriteTime         Length Name

----                -------------         ------ ----

-a----       13.03.2018     13:21            374 hello_world.ps1

Reply
0 Kudos
feixfb
Contributor
Contributor

Hmm ok... i think i found the problem. If i copy the script on a local place and a way from the network drive it will work Smiley Sad

Reply
0 Kudos
LucD
Leadership
Leadership

Looks like Get-Help is not "localised", in other words not for the culture settings you are using.

Do you have a PowerShell installation with en-US to check?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
feixfb
Contributor
Contributor

hey LucD,

in the moment not. Do you think that it will work also on networkdrives with a en-us culture setting?

Reply
0 Kudos
LucD
Leadership
Leadership

Afaik it's the culture settings in the OS where you start PowerShell.
So I'm not sure a network drive settings has any influence on this.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos