Comparison3 min
PowerShell LTS vs. Stable: Which Release to Install
LTS lets your scripts run for years on security fixes alone, while Stable trades that stability for new features and an upgrade every time a new LTS ships.
PowerShell passes objects, not text, so exit codes, $null checks and ValidateSet behave unlike Bash or cmd, and the script runs on past the mistake.
Most of these gotchas let a script keep going, so the failure shows up after the line that caused it. Start from what you see:
| What you see | Why | Read |
|---|---|---|
$LASTEXITCODE doesn’t change after a cmdlet fails | Cmdlets never set it; native programs and scripts do. Add -ErrorAction Stop to the cmdlet. | $LASTEXITCODE and cmdlets |
try/catch doesn’t catch a cmdlet’s error | A cmdlet’s error doesn’t stop the script by default, so it never reaches catch. -ErrorAction Stop fixes this too. | $LASTEXITCODE and cmdlets |
$items -ne $null returns items, not true or false | With an array on the left, a comparison filters the array. Write $null -ne $items. | $null on the left |
ValidateSet accepts Prod where you wrote prod | String matching ignores case by default. | Parameter validation |
A script works at your prompt but fails as a scheduled task, which still reports 0x0 | The task can run as another account, and without a Start in value it runs in C:\Windows\system32. | Works manually, fails in Task Scheduler |
| Task Scheduler records 1 where your script exited with another code | Under -Command, any exit code other than 0 or 1 reaches the caller as 1. -File passes it on. | -File vs. -Command |
curl in Windows PowerShell 5.1 doesn’t take curl’s options | In 5.1, curl and wget are aliases for Invoke-WebRequest (Microsoft Learn (opens in a new tab)). The alias shadows curl.exe, so type curl.exe. PowerShell 7 doesn’t define it (curl on Windows (opens in a new tab)). | Check a name with Get-Command |
Before you run a script you copied, three built-ins show what it will do.
Get-Command says what a name resolves to, Get-Member what an object
carries, and -WhatIf what a command would change, where the command supports
it. Reading a copied script walks
through all three.
For PowerShell running a whole job, read the 7 Days to Die server series. One game server starts at boot, updates only when there’s a new build, and backs up to S3 and restores from that backup on a new machine.
Setting up OpenSSH on Windows from PowerShell has its own hub, SSH.
30 articles
Comparison3 min
LTS lets your scripts run for years on security fixes alone, while Stable trades that stability for new features and an upgrade every time a new LTS ships.
Guide22 min
Configure an Azure server VM to start itself daily, update Windows, and deallocate when idle, so it runs about an hour or two a day instead of 24/7.
Answer11 min
Under -File the caller receives the exit code your script chose; under -Command, any script code other than 0 or 1 reaches the caller as 1.
Guide11 min
You finish with each large C: folder matched to its owner, whether an AI model folder, a package cache or the hibernation file, and to the cleanup it needs.
Troubleshooting18 min
Task Scheduler records the exit code of powershell.exe, not whether the script worked, so a script that hit an error and carried on is recorded as a success.
Guide6 min
Sign in to a Windows 11 Pro machine over SSH with a password, then a key, using PowerShell alone.
Guide14 min
All eleven WN25-SH OpenSSH checks run before and after, and the seven that fail on a fresh Server 2025 image end up printing what their check text expects.
Guide12 min
A 7 Days to Die dedicated server running the old world on a new Windows Server, its build and save files checked against the old one before players move.
Guide13 min
Run a 7 Days to Die server from a Windows scheduled task with no time limit, and stop it over telnet so the shutdown finishes and the world is saved.
Guide7 min
Watch your script handle a real AccessDenied, raised with a throwaway role's temporary keys, without changing your own permissions or writing any data.
Troubleshooting9 min
The analyzer's fix is safe only where code meant a null check; this function relied on the array filter in ways only empty and nearly empty inputs reveal.
Guide11 min
Compare the buildid in the appmanifest with SteamCMD's app_info_print and run app_update only when they differ. Success! and exit code 0 prove nothing.
Guide11 min
A copied restore such as xcopy /E keeps files the backup lacks. Rename the live Saves folder aside and move the archive's in; the old world stays beside it.
Guide14 min
A 7 Days to Die server that starts on a clean Windows Server, with its saves where you choose and TCP 26900 and UDP 26900 to 26902 open in Windows Firewall.
Troubleshooting5 min
Cmdlets never set LASTEXITCODE, so after a failed cmdlet it still holds whatever the last native program returned, often zero.
Guide7 min
You end up with AWS.Tools in Program Files, where a task running as SYSTEM finds it; SYSTEM's module path never includes your Documents folder.
Comparison6 min
Write-S3Object is wrong for repeat runs into a versioned bucket, which keeps every copy; sync is wrong when a restored file keeps its size and old timestamp.
Guideupdated Oct 202622 min
The world lands in S3 every morning as an archive that restores onto a fresh server, and the task's result says whether that morning's copy arrived.
Explorationupdated Sep 20264 min
The friction that moved Windows automation from VBScript's text to PowerShell's objects also moved cloud tooling from scripts to declarative templates.
Guide6 min
Read a script you copied with the tools built into PowerShell, without running anything that changes your files.
Guide6 min
Validation attributes stop a PowerShell script before it runs on bad input, but ValidateSet and ValidatePattern ignore case unless told not to.
Guideupdated Sep 20266 min
Enabling SSH on Windows Server 2025 lets only Administrators and the OpenSSH Users group sign in. You turn it on with PowerShell, then choose who's in it.
Guideupdated Oct 202612 min
Automate fetching the month's Patch Tuesday KBs and CVEs in plain PowerShell, as objects you can filter by product, severity or exploit status.
Guideupdated Sep 20265 min
Windows OpenSSH ignores an administrator's authorized_keys. Put the key in administrators_authorized_keys with the right ACL, scripted for a fresh server.
Guideupdated Sep 20265 min
Install the OpenSSH server with PowerShell, start sshd at boot, confirm the port 22 rule, and connect, plus where an administrator's key really goes.
Guide7 min
Send data from your PowerShell scripts to CloudWatch to graph and alarm on, with one cmdlet that runs on Windows, macOS or Linux.
Guide4 min
Windows Server 2022 has no winget, but VS Code's own installer takes switches that install it for every account without showing a window.
Explorationupdated Sep 20268 min
Splatting forces every parameter of a long command to be named and laid out, which keeps it readable and safe to change years after it was written.
Answer4 min
HideFileExt set to 0 shows file extensions for your account, and one Active Setup entry sets it for every account on the machine at its next sign-in.
1 min
Who writes Loosely Decoupled and how to get in touch.