Search Knowledge

© 2026 LIBREUNI PROJECT

Operating Systems Internals / System Interfaces & Commands

Windows PowerShell: The Object-Oriented Shell

Windows PowerShell

For decades, the Windows command prompt (cmd.exe) was a source of mockery for Unix developers. It was clumsy, lacked basic features, and its scripting language (Batch) was a nightmare. In 2006, Microsoft released PowerShell. It wasn’t just a better shell; it was a completely new paradigm for system administration.

The Core Difference: Objects vs Text

In a Unix shell (like Bash), everything is a String of Text. If you run ls -l, you get a table of text. If you want to find only files larger than 1MB, you have to use complex text-processing tools like awk or sed to “cut out” the column of text that represents the file size and compare it.

In PowerShell, everything is a .NET Object. When you run Get-ChildItem (the PowerShell version of ls), you don’t get text. You get an array of FileInfo objects. Each object has properties like .Name, .Length (size), and .LastWriteTime.

Command: Get-ServicePipelineOutput ObjectStatus: RunningName: wuauservDisplayName: Windows Update

Verb-Noun Syntax

PowerShell uses a very strict naming convention: Verb-Noun. This makes it extremely “discoverable.”

  • Get-Service: List all services.
  • Stop-Service -Name "wuauserv": Stop the Windows Update service.
  • New-Item -Path "C:\test.txt" -ItemType "File": Create a file.

If you don’t know the command you need, you can search for it: Get-Command *process*

The Pipeline on Steroids

Because the pipeline | passes objects instead of text, you can perform powerful operations with almost no code.

Get-Process | Where-Object { $_.CPU -gt 100 } | Stop-Process Translation: Get all processes, filter for those using more than 100 units of CPU, and stop them.

Notice how we don’t have to specify “which column” the CPU usage is in. We just access the .CPU property of the object.

Essential PowerShell Commands (and their Unix Aliases)

PowerShell includes “aliases” to make Unix users feel at home, but underneath, they are different commands.

ConceptPowerShell CommandAlias
List filesGet-ChildItemls, dir
Change directorySet-Locationcd
View fileGet-Contentcat, type
Search textSelect-Stringgrep
Process listGet-Processps
Copy itemCopy-Itemcp

Power in the Enterprise: Active Directory and Azure

PowerShell is the “Sovereign” of the enterprise.

  • Remoting: You can run a command on 1,000 servers simultaneously using Invoke-Command.
  • Active Directory: You can create 500 new user accounts, assign them to groups, and set their passwords in a 3-line script.
  • Azure: Microsoft’s cloud platform is almost entirely manageable via PowerShell modules.

PowerShell Core (pwsh)

Originally, PowerShell only ran on Windows. However, Microsoft eventually open-sourced it and created PowerShell Core. It now runs on Linux and macOS. While it will never replace Bash for local scripting on Linux, it is becoming a popular choice for “DevOps” engineers who need to manage multi-cloud environments (AWS + Azure) using a single, consistent language.

Which shell should you use?

  • Use Bash/Zsh if you are working on a web server, doing data science, or developing for Mac/Linux. Its text-processing ecosystem is unmatched.
  • Use PowerShell if you are managing a Windows fleet, automating cloud infrastructure, or doing complex system-level automation where “objects” are more useful than “text.”

In the next module, we will explore the “layers” above the command line: Package Management and how OSs keep themselves up to date.