Skip to the main content.

PowerShell Tips

Adding help links to PowerShell functions

Table of contents

Post Featured Image

Tobias & Aleksandar's tip #8:

The two very well-known PowerShell experts have teamed up to share their best and most helpful PowerShell tips.

We will be publishing their scripts over the course of Scriptember in 13 blog posts. Don't miss their insights! Be sure to follow all Scriptember events, listed in our calendar here

 

Overview of all 13 articles published during Scriptember

 

 

Adding help links to functions

When creating PowerShell functions, there’s a simple way to add a URL to any website you like. Whether you host your code publicly at GitHub, or whether you run an internal web portal in your company, you can easily have functions point to wikis, example tutorials, or support:


function Invoke-Something
{
   [CmdletBinding(HelpUri='https://support.scriptrunner.com/')]
   param()
   
   'Get-Help Invoke-Something -Online' | Set-ClipBoard
   "In order to see my help, run Get-Help Invoke-Something -Online. I placed the commands into your clipboard."


When you run this function, nothing special happens as it is just illustrating the function wrapper with no special code inside it. However, the function defined a "HelpUri", and users can now easily visit this URL in their browser by using Get‑Help -Online:

  • PS C:\> Get-Help Invoke-Something -Online

 

 

Good2know


Scriptember! Stay tuned:

During Scriptember, our calendar provides the best possible overview.  

Scriptember - hier ist die Übersicht

 

  • Follow us on social media, look for and use the hashtags #Scriptember and #PowerShell.
  • Join our live sessions, overview soon here.
  • Participate in challenges and contests. 
  • Share your knowledge.

 

Find all events here!

 

 

Related links 



Related posts

7 min read

Hidden configuration variables in PowerShell

Tobias & Aleksandar's tip #13:

The two very well-known PowerShell experts have teamed up to share their best and most...

4 min read

Hiding confirmations in PowerShell

Tobias & Aleksandar's tip #12:

The two PowerShell experts have teamed up to share their best and most helpful...

4 min read

URL Encoding in PowerShell

Tobias & Aleksandar's tip #11:

The two very well-known PowerShell experts have teamed up to share their best and most...

About the author: