Blog Posts
Everything published on this blog since 2017, newest first. The SQL Server writing now lives at sqldba.blog.
Guides: Claude Code · PowerShell · WSL · Windows
-
Call the Claude API From PowerShell
Send a prompt to Claude from PowerShell with Invoke-RestMethod: the API key in an environment variable, a JSON body built with ConvertTo-Json -Depth, UTF-8 in Windows PowerShell 5.1, reading the text from the reply, and handling errors.
-
Check an AI-Written PowerShell Script Before You Run It
Before you run a PowerShell script an AI wrote, check whether -WhatIf really works, read the param block, add Set-StrictMode, run PSScriptAnalyzer and use Get-Command to see what each command is.
-
Store API Keys Safely in PowerShell
Keep API keys out of your scripts with SecretManagement and SecretStore: Register-SecretVault, Set-Secret, Get-Secret -AsPlainText, checking your history for a pasted key, and the trade-off for scheduled tasks.
-
ConvertTo-Json Depth: Why Nested JSON Shows System.Collections.Hashtable
ConvertTo-Json only writes two levels by default, so nested data becomes System.Collections.Hashtable. Fix it with -Depth, why 5.1 gives no warning, API request bodies, the limit of 100, and the one-item array gotcha.
-
How to Shut Down a Computer with PowerShell and CMD
Shut down a Windows computer or server from PowerShell with Stop-Computer or from CMD with shutdown /s, check it first with -WhatIf, and cancel a scheduled shutdown with shutdown /a.
-
How to Check the Last Reboot Time of a Windows Computer
Check the last reboot time of a Windows computer with Get-Uptime in PowerShell 7, Get-CimInstance in Windows PowerShell 5.1, systeminfo in the Command Prompt, or Task Manager, and find out why it restarted.
-
Claude FM: The /radio Command in Claude Code
Type /radio in Claude Code and it opens Claude FM, the lo-fi music stream Anthropic runs on YouTube, in your browser. What you see, what happens with no browser, and what to do if the command is missing.
-
Kill a Process by Name or ID in PowerShell
Kill a process in PowerShell with Stop-Process, by name or by process ID, preview it with -WhatIf, stop whatever is holding a port, and why -Name notepad.exe finds nothing.
-
Search Your PowerShell Command History with Ctrl+R
Press Ctrl+R in PowerShell to search every command you have run before, keep pressing to cycle through matches, and Enter to run it. Plus F8, Get-History and where the PSReadLine history file lives.