Help Distribution Example

2014w29-GP-PowerShell-Update-Help-exampleEarlier today, I opened the topic of Windows PowerShell Help update distribution. This article continues where that one left off.

Once you have saved help information to a file share, other computers can be updated from that information. Three ways to perform such updates are described herein. They are:

• Manual Update
• Semi-Automatic Updates using a PowerShell Scheduled Job
• Automatic Updates using Active Directory-based Group Policy

The Manual technique simply involves running the Update-Help cmdlet to perform a one-time upon of a machine. The “Semi-Automatic” approach merely creates a new PowerShell scheduled job to periodically run the same update. Finally, the Automatic method uses the Group Policy setting with the path:

‣ Computer Configuration >
‣ Policies >
‣ Administrative Templates >
‣ Windows Components >
‣ Windows PowerShell >
‣ Set the default source path for Update-Help

In all three cases, the source path for the updates need to come from the file share in which you had saved the help information by using Save-Help. When using the Update-Help cmdlet directly for the manual and semi-automatic styles, the -SourthPath parameter is used to provide the appropriate path. For the automatic approach, a Group Policy Object (GPO) could be created with the aforementioned setting enabled and its Default Source Path value assigned the same path. Consider the following snapshot of a script depicting these three techniques, along with the prerequisite creation of the file share and populating it Save-Help.

The comments in the script provide commentary on the different sections and their use relative to the descriptions included above. For your convenience the contents of the script has been retranscribed here with some minor edits. I hope that this helps. Please let me know of any questions or suggestions. Thank you!

# Set up the PowerShell-Help share
New-Item -Path E:PowerShell-Help -ItemType Directory
New-SmbShare -Name PowerShell-Help -Path E:PowerShell-Help

# Update the share. This should be done when additional modules are needed,
# or when new versions are available.
Save-Help -DestinationPath lon-dc1PowerShell-Help

# “MANUAL” method:
# Clients can manually pull down the updates using:
Update-Help -SourcePath lon-dc1PowerShell-Help

# Clients could alternatively request regularly scheduled updates:
Register-ScheduledJob -Name UpdateHelpJob -Credential ADATUMPSHelpUpdater `
-ScriptBlock { Update-Help -SourcePath lon-dc1PowerShell-Help } `
-Trigger (New-JobTrigger -Daily -At “3 AM”)

# “AUTOMATIC” approach:
# Or, set clients up to get updates via Group Policy
$myGPO = “PowerShell Policy”
$myKey = ‘HKLM:SOFTWAREPoliciesMicrosoftWindowsPowerShellUpdatableHelp’
$myPath = ‘lon-dc1PowerShell-Help’
New-GPO -Name $myGPO
New-GPLink -Name $myGPO -Target “OU=IT,DC=ADatum,DC=com”
Set-GPRegistryValue -Name $myGPO -Key $myKey `
-ValueName ‘EnableUpdateHelpDefaultSourcePath’ -Type DWord -Value 1
Set-GPRegistryValue -Name $myGPO -Key $myKey `
-ValueName DefaultSourcePath -Type String -Value $myPath

Windows PowerShell Help Distribution

Early versions of Windows PowerShell came bundled with detailed help information (i.e. 1.0 and 2.0). In recent versions—3.0 and 4.0—the help information that is initially installed with Windows PowerShell has been trimmed down to reduce the size of the installation footprint on the many servers and workstations on which much or all of the help information may be construed as unnecessary baggage. PowerShell version 3.0 introduced the Update-Help cmdlet to download the extra detailed help information, and Save-Help was included with version 4.0 to allow downloading once, then updating one or many computers offline from that saved saved repository.

Here are some links to articles from Microsoft on Update-Help and Save-Help, one from Thomas Lee on the topic, and two from Mike F. Robbins that might all be helpful.

Update-Help: <>
Save-Help: <>
Thomas Lee: <>
Mike F. Robbins: <> and part 2: <>

In particular, I would recommend reading examples four and five from the Update-Help article. These topics relate to scenarios that people often ask about. I suggest deriving your own update scripts and techniques for how you want to run the updates, however the fundamentals are included in those two parts of Microsoft’s documentation (Update-Help link above). I have taken the liberty of quoting those two examples below. Everything below this paragraph is quoted directly from Microsoft’s Update-Help help topic. I hope this helps. Please let me know of any questions. Good luck!

From: Microsoft’s Update-Help PowerShell help topic.

Example 4: Update help automatically
This command creates a scheduled job that updates help for all modules on the computer every day at 3:00 in the morning.
The command uses the Register-ScheduledJob cmdlet to create a scheduled job that runs an Update-Help command. The command uses the Credential parameter to run the Update-Help cmdlet with the credentials of a member of the Administrators group on the computer. The value of the Trigger parameter is a New-JobTrigger command that creates a job trigger that starts the job every day at 3:00 AM.
To run the Register-ScheduledJob command, start Windows PowerShell with the “Run as administrator” option. When you run the command, Windows PowerShell prompts you for the password of the user specified in the value of the Credential parameter. The credentials are stored with the scheduled job; you are not prompted when the job runs.
You can use the Get-ScheduledJob cmdlet to view the scheduled job, use the Set-ScheduledJob cmdlet to change it, and use the Unregister-ScheduledJob cmdlet to delete it. You can also view and manage the scheduled job in Task Scheduler in the following path: Task Scheduler LibraryMicrosoftWindowsPowerShellScheduledJobs.

Windows PowerShell

PS C:> Register-ScheduledJob -Name UpdateHelpJob -Credential Domain01User01 -ScriptBlock {Update-Help} -Trigger (New-JobTrigger -Daily -At “3 AM”)
Id         Name            JobTriggers     Command                                  Enabled
—         —-            ———–     ——-                                  ——-
1          UpdateHelpJob   1               Update-Help                              True

Example 5: Update help on multiple computers from a file share
These commands download updated help files for system modules from the Internet and save them in file share. Then the commands install the updated help files from the file share on multiple computers. You can use a strategy like the one shown here to update the help files on numerous computers, even those that are behind firewalls or are not connected to the Internet.
All of the commands in this example were run in a Windows PowerShell session that was started with the “Run as administrator” option.

The first command uses the Save-Help cmdlet to download the newest help files for all modules that support Updatable Help. The command saves the downloaded help files in the Server01SharePSHelp file share.
The command uses the Credential parameter of the Save-Help cmdlet to specify the credentials of a user who has permission to access the remote file share. By default, the command does not run with explicit credentials and attempts to access the file share might fail.

Windows PowerShell

PS C:> Save-Help –DestinationPath Server01SharePSHelp -Credential Domain01Admin01

The second command uses the Invoke-Command cmdlet to run Update-Help commands on many computers remotely.
The Invoke-Command command gets the list of computers from the Servers.txt file.
The Update-Help command installs the help files from the file share on all of the remote computers. The remote computer must be able to access the file share at the specified path.
The Update-Help command uses the SourcePath parameter to get the updated help files from the file share, instead of the Internet, and the Credential parameter to run the command with explicit credentials. By default, the command runs with network token privileges and attempts to access the file share from each remote computer (a “second hop”) might fail.

Windows PowerShell

PS C:> Invoke-Command –ComputerName (Get-Content Servers.txt) –ScriptBlock {Update-Help –SourcePath Server01ShareHelp -Credential Domain01Admin01}