About Update-Help first prompt

As you may already know, as of Powershell version 3.0, you get a prompt to update help files the first time you invoke the Get-Help cmdlet.
You can read about it in the Remark section of the Get-Help cmdlet.

Get-Help Get-Help -Full

As I was doing a lab last week, I tried to use Get-help inside a virtual machine without realizing that it was the VM and not the host. D’oh!
I answered No as I realized that the VM wasn’t wasn’t connected to the internet. 😦

Now, instead of using the Update-Help, how do I restore that first prompt.

As you can see in the above screenshot, PowerShell writes a REG_DWORD value in the above registry locations.
Removing the two values makes it:

gp HKLM:\SOFTWARE\Microsoft\PowerShell | rp -Name "DisablePromptToUpdateHelp"            
gp HKLM:\SOFTWARE\Wow6432Node\Microsoft\PowerShell | rp -Name "DisablePromptToUpdateHelp"            

Here’s another way (with error handling) to perform the removal of the 2 registry values:

$null,"Wow6432Node" | ForEach-Object {
    try {
        Remove-ItemProperty -Name "DisablePromptToUpdateHelp" -Path "HKLM:\SOFTWARE\$($_)\Microsoft\PowerShell" -ErrorAction Stop
    } catch {
        Write-Warning -Message "Failed because $($_.Exception.Message)"
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s