I can't believe PowerShell is good
Recorded: Oct. 22, 2026, 5 a.m.
| Original | Summarized |
I can't believe PowerShell is actually good Home I can't believe PowerShell is actually good Corbin Davenport 21 Oct 2026 Share Microsoft makes a lot of bad software. That includes many aspects of Windows, from the primary email application being a web wrapper to the ever-present Copilot buttons. As such, it's always a surprise to me when I find a Microsoft product that improves my life in some respect, especially when it's something that came from Windows.I never paid much attention to PowerShell, the command-line shell and scripting tool that first arrived in 2006, and became a bundled application with the release of Windows 7. For the time period I used Windows as my main desktop operating system, I mostly stuck to the Command Prompt and Batch scripts, or Bash in WSL or Python for more complex tasks. The modern version of PowerShell is cross-platform, and can also be installed on Mac and Linux.Earlier this year, I needed to learn PowerShell scripting for one Windows-related project, and I have tried it out a few more times on Mac. It has quickly become one of my favorite tools for automation and scripting—taking on jobs that I would have otherwise tried to do with Node.js, Shortcuts, macOS Automator, or heaven forbid, Bash scripts.I get it now. PowerShell is great, even if you don't use it as your shell, and even if you're on Mac or Linux.Bashing my head against the wallThe most common way to run a sequence of commands on Linux, macOS, and other Unix-based environments is with a Bash script. They are also called shell scripts, even though they're not technically the same thing, because they are also used by other shells like Z Shell (zsh).Here's an example Bash script that asks you for a media URL, and then uses the yt-dlp application to save it as an MP3 audio file to your Desktop folder:#!/bin/bash echo -e "Enter a URL: " Set-Location -Path ~/Desktop yt-dlp -x --audio-format mp3 "$url" Invoke-WebRequest $GoogleChromeInstallRegistry -OutFile "$env:LocalAppData\chrome.reg" $ChromeInstall = Start-Process "reg.exe" -ArgumentList "import `"$env:LocalAppData\chrome.reg`"" -WindowStyle Hidden -Wait -PassThruThis uses the Invoke-WebRequest cmdlet to download the registry file from the provided URL, and stores it temporarily in the user account's AppData folder. It then starts the reg.exe command in a hidden window, tells it to import the file that was just downloaded, and waits until the command is completed. PowerShell could modify the keys directly, but I wanted them to be in a separate file that can be imported manually, since not everyone wants to use the automated installer.The Invoke-WebRequest cmdlet works like Wget or cURL on a Mac or Linux system, allowing you to download web content in your script. That's another feature built into PowerShell on all platforms that I frequently need in Bash scripts.🤦♂️Earlier versions of Windows PowerShell included an alias for the curl command that redirected to Invoke-WebRequest. It didn't support all the same features as cURL, which led to people filing bug reports for the actual cURL project. That alias was removed in PowerShell 7, and Windows now includes the real application.I wanted the installer to work in older versions of Windows PowerShell, so it could run on older PCs without first upgrading the PowerShell version. That only required a few alterations, like this command that enables TLS v1.2 before using Invoke-WebRequest, because it used to not be enabled by default:[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12For another project, I was experimenting with merging my old Tumblr blog into my main personal website, which uses the Eleventy static site generator. There were no existing tools for that, so I created a "Tumblr to Eleventy" PowerShell script.The script has two main inputs: Tumblr's archive export, which is a bunch of HTML and media attachments in a ZIP file, and the Tumblr API. It uses Invoke-WebRequest and ConvertFrom-Json to check the API and iterate through all posts on the blog, Expand-Archive to extract the ZIP file, and cmdlets like Copy-Item and New-Item to create a new file structure ready for an Eleventy site.The most important part was keeping all the metadata from the original Tumblr post, including the title, permalink, publish date, and tags. The script does that by creating a custom object with all the data, then turns it into Eleventy-friendly JSON format with the ConvertTo-Json cmdlet:$OutputJson = Join-Path -Path $OutputPath -ChildPath "index.json" $PostMetadata = [PSCustomObject]@{ $PostMetadata | ConvertTo-Json -Depth 1 | Set-Content -Path $OutputJson -Encoding UTF8The $Post variable contains the response from the Tumblr API, so this is just mapping that data to the keys that Eleventy expects. For example, the API sometimes put my post titles as the summary instead of the title, so the script checks .title first and uses .summary as the fallback. Tumblr provided the publish date and time for each post in Unix time, which PowerShell can convert to the UTC format required by Eleventy.I probably would have used Node.js for this if it wasn't PowerShell, since Node does have built-in web requests and file handling. However, it would have needed external dependencies for simple tasks like unzipping the archive (either calling the system's unzip or using a JS-native library), as well as await statements all over the place. I didn't end up moving my blog, but hopefully someone else will find that script useful.Another tool in the toolboxI'm still getting the hang of PowerShell scripting, but I have come away more impressed with it after every project. It's cross-platform, more predictable and reusable than Bash scripts, and relatively easy to understand. I can't believe this came out of the same company as Copilot.Of course, none of this matters if you do scripting and automation the cool way, with Claude or another AI chatbot taking the wheel. The bot can do the thinking and testing for you. However, I like learning things, and I'm trying my best to prevent my brain from atrophying. A local Gemma 4 model in LM Studio did help me with troubleshooting when web searches failed, but the vast majority of my scripting thus far has been lovingly hand-crafted.If you're interested in learning how to use PowerShell, there are plenty of online guides and video tutorials. I have been watching "PowerShell 7 for Beginners" from JackedProgrammer, and I might even get a reference book at some point. It can go right next to my 1996 paperback edition of O'Reilly's HTML: The Definitive Guide. Sign up for The Spacebar Subscribe Email sent! Check your inbox to complete your signup. No spam. Unsubscribe anytime. Read more This is every Ubuntu Linux default wallpaper 16 Oct 2026 How to turn off AI Overviews in Google with "Web" mode 08 Oct 2026 How to turn off Copilot in Visual Studio Code (and other AI features) 06 Oct 2026 My weekend at a 28,000-person virtual reality convention 16 Jun 2026 The Spacebar Thoughts about retro tech, web browsers, and anything else. Subscribe Email sent
Powered by Ghost Mastodon |
Corbin Davenport recounts a significant shift in his technical perspective regarding PowerShell, moving from initial skepticism rooted in Microsoft broader software reputation to genuine appreciation for its capabilities. Initially relying on Command Prompt, Batch scripts, or Bash within WSL and Python for complex tasks, Davenport discovered PowerShell 7 during a Windows related project. Unlike the legacy Windows PowerShell version, PowerShell 7 is a modern cross platform environment built on .NET Core, available across Windows, macOS, and Linux. His evaluation highlights a stark contrast between PowerShell and traditional Bash scripting. While Bash suffices for basic command sequences, it lacks comprehensive built in functions, forcing reliance on external POSIX utilities like curl or jq for routine operations. This dependency creates significant portability challenges, as scripts frequently fail across different shells or systems lacking specific tools. Consequently, developers often resort to heavier programming languages like Python or Node.js, which introduce syntax preferences and asynchronous boilerplate that complicate straightforward automation tasks. PowerShell addresses these limitations through a structured command ecosystem known as cmdlets, which follow consistent verb noun naming conventions and handle common operations natively. The environment provides robust parameter management, allowing scripts to define mandatory inputs with explicit data types without requiring extensive parsing code. This built in validation streamlines user interaction and error handling. Furthermore, PowerShell operates as a fully object oriented platform with native support for integers, strings, arrays, and hash tables. This architecture simplifies data manipulation, particularly when interfacing with web APIs or processing JSON, as the shell natively converts between formats. Cross platform compatibility is maintained through intelligent path resolution, where tilde expansion and automatic slash conversion ensure consistent directory navigation regardless of the underlying operating system. Davenport illustrates these advantages through several practical implementations. A media downloading utility demonstrates how parameter blocks enforce input validation while maintaining simplicity. A browser configuration installer leverages PowerShell virtual drive system, which abstracts the Windows Registry into a filesystem like structure. This allows registry keys to be queried and modified using standard file system cmdlets, eliminating the need for specialized registry management syntax. The script also incorporates network requests via built in web cmdlets and includes compatibility adjustments for older Windows environments by explicitly enabling modern security protocols through .NET classes. Another project involved migrating legacy blog content to a static site generator, where PowerShell processed API responses, extracted compressed archives, and mapped complex metadata into structured JSON formats. This workflow avoided external dependencies typically required in JavaScript environments for file extraction and data transformation, showcasing PowerShell capacity to handle intricate automation without sacrificing readability or maintainability. The author concludes that PowerShell delivers a predictable, reusable, and cross platform scripting experience that surpasses traditional shell environments for complex automation. While acknowledging the utility of AI assisted development, Davenport emphasizes the value of direct engagement with scripting fundamentals to preserve technical proficiency. He recommends structured learning resources for developers seeking to integrate PowerShell into their workflows, noting its capacity to streamline system administration and data processing tasks across diverse computing environments. |