Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

PowerShell First-Timers

Posted on May 11, 2022May 11, 2022

Are you a PowerShell first-timer? Someone who is finally dipping their toes into the PowerShell pool. Or maybe you want to poke around and see what all the fuss is about. If so, here are some steps you might want to take. Even if you've been using PowerShell for a while, you might want to double-check your desktop against my recommendations.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

Windows PowerShell ships with Windows 10 and Windows 11, but the bits haven't changed in the image for years. If you have installed PowerShell 7, that too may require some updating. Unfortunately, there are a few gotchas, but I can help you out.

Update Help Content

The first thing you should do on any new installation is update the help. PowerShell ships with minimal help. You only need to do this on computers where you are running PowerShell interactively and writing scripts. This is typically your Windows 10/11 desktop. Because some of the help content is in administrator-level directories, you should use an elevated PowerShell session run as an administrator.

The command is simple enough.

Update-Help -force

You should expect to see a few errors. Not every module has valid links for updateable help. If you see errors for lots of modules, something probably went wrong. Make sure you run this in an elevated PowerShell session.

Help content is updated all the time, but there is no mechanism to inform you when to update help. I manually update help whenever I realize I haven't done it in a while. Or you could put something in your PowerShell profile script.

$today = Get-Date
$days = 1,11,22
if ($days -contains $today.day) {
    #update help
    Write-Host "Updating help via a background job" -ForegroundColor yellow
    [void](Start-Job {Update-Help -force})
}

This will update help on the specified day of the month.

PowerShell Get

Part of the update process is going to include modules. This will use commands from the PowerShellGet module, which itself should be updated. Run Get-Module to test your version.

default PowerShellGet version

If you don't see any newer versions, you need to update this module.

update powershellget error

Well, technically, you need to install it. Because v1.0.0.1 was not installed with Install-Module, you can't upgrade it. You have to install it.

Install-Module PowerShellGet -Force

Once you've done this, you can use Update-Module in the future. At this point, I recommend restarting your PowerShell session to ensure you load the new version of commands like Find-Module and Install-Module.

The PowerShell Gallery was reconfigured a while ago to require updated TLS settings. If you get errors trying to find or install modules that indicate connection failures or "can't find module," you might need to adjust your security settings. I believe Microsoft has updated Windows 10/11 to avoid this problem, but if you need it, run this command from a PowerShell prompt.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

If your OS isn't current, you should put this statement in your PowerShell profile script.

PSReadline

You absolutely want the latest version of PSReadline. This module provides command completion and prediction, among other valuable services.

default PSReadline

If this is the only version you see, you need to upgrade. This module also ships with Windows, so you can't upgrade it. You have to install it.

Install-Module PSReadline -force

As with PowerShellGet, from here on out, you can update it.

Pester

If you are writing scripts and modules, you should also be writing Pester tests. The Pester module ships with Windows.

Not a problem. By now, you know you should use Install-Module.

Sorry. There is a long-standing bug with the security catalog associated with the Pester module. I have no idea why this hasn't been resolved. Regardless, here's how you can install it.

Install-Module Pester -force -skipPublisherCheck

Summary

Most of these tasks are one-time events. Once you get a few out-of-the-box modules installed, you can keep them up to date with Update-Module. I know you'll have a better PowerShell experience if you take the time to run through these tasks.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

3 thoughts on “PowerShell First-Timers”

  1. Pingback: PowerShell First-Timers - The Lonely Administrator - Syndicated Blogs - IDERA Community
  2. Aleksandr says:
    May 13, 2022 at 7:48 am

    Thanks a lot! I just wanted to write a similar instruction for my colleagues. This article will be my template. I also wanted to add that PSReadline has a bug and needs to be updated. https://github.com/PowerShell/PSReadLine/issues/798

  3. Marcus says:
    May 15, 2022 at 4:56 am

    Loved that item about regularily updating help contents with code in your profile. But because I am that way I extented it so that it only runs once on the specified days by storing the last update date in a user scope environment variable).

    $today = Get-Date
    $currDate = $today.ToString(“yyyy-MM-dd”)
    $days = 1,15
    if ($days -contains $today.day) {
    $lastUpdate = [System.Environment]::GetEnvironmentVariable(‘PSHelpLastUpdated’, ‘User’)
    If (-not $lastUpdate -or $lastUpdate -lt $currDate ) {
    #update help
    Write-Host “Updating help via a background job” -ForegroundColor yellow
    [void](Start-Job {Update-Help -force})
    [System.Environment]::SetEnvironmentVariable(‘PSHelpLastUpdated’,$currDate, [System.EnvironmentVariableTarget]::User)
    }
    }

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d