PowerShell Potluck August 2025
Time to wrap up month with a potluck of PowerShell resources and news. And of course, a new PowerShell scripting challenge.
PowerShell: Compare and Contrast
I expect most of you know the primary differences between Windows PowerShell 5.1 and PowerShell 7. But there me be some subtle differences that may be significant to you. PowerShell MVP Harm Veenstra as written a detailed article comparing the two versions. If you are still using Windows PowerShell 5.1 and wondering about moving to PowerShell 7, this is a must read. Spend a few minutes reading https://powershellisfun.com/2025/07/25/powershell-v5-x-and-v7-x-differences/
Choosing the Right Tool
On a related note, I came across a helpful article comparing the various command line tools available on Windows. If you are wondering whether to use Command Prompt, PowerShell, or Windows Terminal, this article will help you make an informed decision. Although my recommendation is to live in a PowerShell prompt running in Windows Terminal, assuming you are on a Windows platformn.
Check out https://www.izoate.tech/blog/choosing-the-right-command-line-tool-for-your-needs-cmd-vs-powershell-vs-windows-terminal/ for all the details.
PSPreworkout
I am pretty sure I've written about this module before, but there is a new version of the PSPreWorkout module. This module is designed with commands to help you get started with PowerShell, including tasks such as setting up your environment. You might need to install Winget using Install-Winget
or installing the popular Oh My Posh prompt theme engine using Install-OhMyPosh
.
I especially like Show-WithoutEmptyProperty
which displays an object without any empty properties. This is a great way to clean up the output of commands that return objects with many properties, some of which may be empty or null.
For example, many CIM results will have many empty properties.
PS C:\> PS C:\> Get-CimInstance Win32_ComputerSystem | Select *
AdminPasswordStatus : 0
BootupState : Normal boot
ChassisBootupState : 3
KeyboardPasswordStatus : 1
PowerOnPasswordStatus : 0
PowerSupplyState : 3
PowerState : 0
FrontPanelResetStatus : 2
ThermalState : 3
Status : OK
Name : PROSPERO
PowerManagementCapabilities :
PowerManagementSupported :
Caption : PROSPERO
Description : AT/AT COMPATIBLE
InstallDate :
CreationClassName : Win32_ComputerSystem
NameFormat :
PrimaryOwnerContact :
PrimaryOwnerName : Jeff Hicks
Roles : {LM_Workstation, LM_Server, NT}
InitialLoadInfo :
LastLoadInfo :
ResetCapability : 1
AutomaticManagedPagefile : True
...
You might like to view the results without all the empty properties.
PS C:\> Get-CimInstance Win32_ComputerSystem | Show-WithoutEmptyProperty
Caption : PROSPERO
Description : AT/AT COMPATIBLE
Name : PROSPERO
Status : OK
CreationClassName : Win32_ComputerSystem
PrimaryOwnerName : Jeff Hicks
Roles : {LM_Workstation, LM_Server, NT}
ResetCapability : 1
AutomaticManagedPagefile : True
AutomaticResetBootOption : True
...
After you install the module from the PowerShell Gallery take a look at all the commands:
Get-Command -Module PSPreworkout
PowerShell in the Pipeline: CI/CD with GitHub Actions
Working with GitHub Actions is definitely an advanced topic. This is something used very often in DevOps where you are setting up a Continuous Integration/Continuous Deployment (CI/CD) pipeline. Although, can use GitHub Actions for other purposes as well. The online documentation can only take you so far, which is why I was pleased to find this video from the PowerShell Wednesday series on using GitHub Actions. In the video you will learn the basics of GitHub Actions and how you might use them to automate your modules and projects. Spend a lunch hour watching https://www.youtube.com/watch?v=trP2LLDynA0.
PSConfEU MiniCon 2025
I know it is difficult to travel to conferences. So if you can attend a virtual one, why not? Especially if it is free. The people behind PSConfEU also host a free, online virtual conference each call called MiniCon. This year's event is October 14. The schedule isn't available yet, nor have speakers been announce, but I have no doubt it will be a valuable use of your time. Check out https://psconf.eu/recordings/minicon-2024/ for a look at last year's event.
Even though the event is free, you do need to register. You can do so at: https://ti.to/synedgy/psconfeu-minicon-2025
RunOnSave extension
I've been using a new VSCode extension that I think might interest you. It is called RunOnSave. This extension allows you to run commands whenever you save a file. For example, you might want to run PSScriptAnalyzer or Pester tests whenever you save a PowerShell script. Or maybe you want to automatically format your code using the built-in formatter. Install the extension in VS Code.

There are a few settings you can configure. Go to File | Preferences | Settings and search for "Run On Save". I use this primarily for my PowerShell work.

You will need to edit the settings.json file directly. I'll admit I'm not doing anything dramatic. I have a script file that maintains a log when I file is updated.
#requires -version 5.1
param(
[Parameter(Mandatory, Position = 0)]
[string]$Path
)
$log = 'C:\temp\save-log.txt'
'[{0}] Saving File: {1}' -f (Get-Date), $Path | Out-File -Append -FilePath $log
In the settings.json file, I added the following configuration:
"emeraldwalk.runonsave": {
"message": "Starting RunOnSave",
"messageAfter": "Ending RunOnSave",
"commands": [
{
"match": "\\.ps(m)?1",
"showElapsed": true,
"cmd": "pwsh -noprofile -nologo -file c:\\scripts\\save-log.ps1 ${file}",
"autoShowOutputPanel": "always",
"message": "Starting PowerShell file save logging",
"messageAfter": "Ending PowerShell file save logging",
}
]
}
My setting only applies to files that end in .ps1 or .psm1. The command runs PowerShell (pwsh) with the -noprofile and -nologo options to speed up execution. The -file option specifies the script to run, and I pass the path of the saved file as an argument.
The extension lets you use placeholders such as ${file}
which is the full path of the file being saved. You can see where I am using this in the command.
These are the other defined placeholders:
- ${workspaceFolder}: the path of the workspace folder of the saved file
- ${file}: path of saved file
- ${fileBasename}: saved file's basename
- ${fileDirname}: directory name of saved file
- ${fileExtname}: extension (including .) of saved file
- ${fileBasenameNoExt}: saved file's basename without extension
- ${relativeFile} - the current opened file relative to ${workspaceFolder}
- ${cwd}: current working directory (this is the working directory that vscode is running in not the project directory)
I wish I could use them in the messaging, but that doesn't seem to work. When I save a PowerShell file, You will see the messaging in the Output panel.

The output is completely optional, and I will probably turn it off at some point by setting "autoShowOutputPanel": "never"
.
Here are some ideas of actions you might want to take when saving a PowerShell file:
- Create a numbered backup
- Digitally sign the script
- Run a script to scan for secrets
- Update the version in source control
I am still tinkering with this extension but I like the automation possibilities.
Scripting Challenge
I can't let you go without a new PowerShell scripting assignment. My scripting project for you this month will be challenging but I think you'll find it rewarding and interesting. Using PowerShell, watch a remote computer and capture information when someone creates a PowerShell remoting session to it. You can test with your computer or a virtual machine. You should capture when the session begins and how long it lasts. I will let you decide how to store the information, but consider how you might work with it later. You might have PowerShell code to set up the monitoring and another script to analyze the results.
You should capture the following information:
- The process ID
- The start time
- The end time
- the process/session run time
- The user's SID. Bonus points if you can resolve it to a user name in the domain\username format.
- The computer name
You will need to figure out what process is launched when a PowerShell remoting session is created.
For advanced scripters, do the same thing but watch for SSH connections to the computer.
Summary
As always, I appreciate your support. If you are not a premium subscriber, please consider upgrading at least for a month or two to see what you've been missing. You can cancel at any time while you gorge on the archive.
See you next month!