April 20th, 2009

Adding your own help links to ISE

PowerShell Team
PowerShell Team

ISE has an F1 help feature, where if you press F1 when your caret is over a cmdlet name, context sensitive help opens.

Shay Levy has a nice post on F1 help in the ISE here
http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2009/01/31/using-help-in-powershell-ise.aspx
He adds “I wanted to mimic the way ISE’s help works when you press F1 and allow an alias to be expanded to cmdlet name.” and he did it with calling hh.exe on the link

There is an alternative way; Add your own help links to the ISE

You can add to $psLocalHelp and $psOnlineHelp, any key to take you to a help page.

For example,
$psIse.Options.LocalHelp = $false
$psOnlineHelp.Add(“Get-MailBox”, “http://technet.microsoft.com/en-us/library/bb123685.aspx“)
Get-MailBox (press F1)

Will take you to that page

With that, adding help for aliases comes down to two lines of code,

Get-Command -CommandType alias | %{$psLocalHelp.Add($_, $psLocalHelp[$_.definition])}
Get-Command -CommandType alias | %{$psOnlineHelp.Add($_, $psOnlineHelp[$_.definition])}

Enjoy,
Ibrahim Abdul Rahim
[MSFT]

Author

PowerShell Team
PowerShell Team

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

0 comments

Discussion are closed.

Feedback