Help, I Need Connectivity!

Help, not just any connectivity,

Help, you know, I need a proxy...

Won't you please, please help me?

...

Right, note to self: ignore the catchy tune and write the post. Here goes...

...

With v3 of PowerShell the Help System delivered a number of improvements. My favourite is the ability to update your help files from the internet, so that you always have the latest and greatest versions.

However... what if your 'jump box' or 'scripting server' doesn't have internet connectivity? This is good security practice so nothing wrong there. There is something wrong with your PowerShell help files, though...

 

No about_CommonParameters help file, no internet connectivity. What to do?

Thankfully, we can create a help file repository on the network that the 'jump box' can use. Here's how to download the help files to a network share.

Save-Help -DestinationPath "\\ninjamem01\PSHelp$" -Force

 

Here's how to update the 'jump box' help files from that network share.

Update-Help -Force -SourcePath "\\ninjamem01\PSHelp$"

NB - ensure that the repository computer has the necessary modules installed for all potential help files, e.g. for Active Directory help files you will need the Active Directory module.

Installing RSAT is a must...

Also, set up a schedule task to perform the repository synchronisation.

Register-ScheduledJob -Name "Save-Help" -Trigger @{Frequency = "Daily"; At = "09:00"} -ScriptBlock {Save-Help -DestinationPath "\\ninjamem01\PSHelp$" -Force}

 

Finally, consider adding similar code to that below to your $Profile on the 'jump server'.

If (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {

Start-Job -ScriptBlock {Update-Help -Force -SourcePath "\\ninjamem01\PSHelp$"}

}

 

This makes sure your help files are updated, from the repository, every time you start your console with administrative privileges (needed to update the local help files).

Sweet!