A thread · 9 notes · Engineering
PowerShell craft.
Small habits and tools that make scripts safer to write, run and hand to someone else.
- 1
The -WhatIf Trap Hiding in ForEach-Object
A dry run that quietly lies to you. Why ForEach-Object's property shorthand returns nothing under -WhatIf, and the one-line fix.
- 2
Check PowerShell Scripts for Syntax Errors Without Running Them
Use PowerShell's own parser to catch typos and broken brackets in a whole folder of scripts, before anything runs.
- 3
Getting the Console Width in PowerShell (Even When There Isn't One)
A width check that works in a real console, in VS Code, and in scheduled tasks and CI runners where there's no window to measure.
- 4
Audit a Windows Service Across Many Computers with PowerShell
Feed it a list of computers and a service name, get back one row per machine saying whether it's installed, running, and how it starts.
- 5
List Installed Software on Windows with PowerShell
A quick, safe software inventory from the registry, local or remote, that returns objects you can filter and export instead of a wall of colored text.
- 6
Finding and Disabling SMBv1 Without Breaking the Scanner
Audit who still talks SMBv1 to your machines, then switch it off for good, with one script and three modes.
- 7
Monitoring Azure Resource Costs with PowerShell
Find out which resource groups are eating your Azure budget, straight from PowerShell, no portal clicking required.
- 8
Install the Grok CLI on Windows Without Pasting Your API Key into a Script
Install Bun if it's missing, install the open-source Grok CLI globally, and save your xAI API key as a user environment variable from a hidden prompt instead of a line in a script.
- 9
A Ping Monitor That Logs Every Outage to CSV
Ping a handful of hosts on a timer, log every reply and every up/down change to CSV, and get a tidy list of outages with start, end and duration when you stop it.