keepcalculator

06 Numbers and Powers

10 Best PowerShell Commands for Beginners

Card No. 06·88017 · Updated · Standard formula, shown below

These are the 10 best PowerShell commands for getting started: Get-Command, Get-Help, Get-Process, Get-Service, Get-ChildItem, Set-Location, Copy-Item, Remove-Item, Select-Object, and Where-Object. With these, you can explore your system, manage files and processes, and filter output—skills that form the foundation for nearly everything else in PowerShell.

Why These Commands Matter

PowerShell is a command-line shell and scripting language built on the .NET framework. Unlike the traditional Command Prompt (cmd.exe), PowerShell works with objects—structured data like processes, services, and files—rather than plain text. This means you can pipe output from one command to another and manipulate it with precision.

For a beginner, the challenge isn’t typing commands; it’s knowing which ones to learn first. The ten below cover the most common tasks: discovering what’s available, getting help, inspecting running processes and services, navigating the file system, and filtering results. Master these, and you’ll be able to accomplish most day-to-day administrative tasks without memorizing hundreds of cmdlets.

Background: PowerShell’s Verb-Noun Structure

PowerShell commands follow a consistent Verb-Noun pattern. The verb describes the action (Get, Set, Copy, Remove), and the noun identifies the target (Process, Service, Item, ChildItem). This makes commands predictable: if you know you want to see running processes, you can guess Get-Process; to stop one, Stop-Process.

This structure is a deliberate design choice. It means once you learn a few verbs, you can apply them to many nouns. For example, Get-Service works just like Get-Process, but for services. The consistency also helps when you’re unsure of a command: you can use Get-Command *-Process to list all commands that deal with processes.

How to Use the Core Commands

Here’s a quick rundown of what each of the ten commands does and a simple example. Open PowerShell (search for “PowerShell” in the Start menu) and try them as you read.

  • Get-Command – Lists all available commands. Use Get-Command -Verb Get to see all commands that retrieve data.
  • Get-Help – Shows detailed help for any command. For example, Get-Help Get-Process -Examples displays usage examples.
  • Get-Process – Lists all running processes with their CPU and memory usage. Try Get-Process | Sort-Object CPU -Descending to see the most CPU-intensive processes.
  • Get-Service – Displays the status of all Windows services. Add | Where-Object {$_.Status -eq 'Running'} to see only running services.
  • Get-ChildItem – Lists files and folders in the current directory. This is the PowerShell equivalent of dir or ls.
  • Set-Location – Changes the current directory. Use Set-Location C:\ to go to the C: drive root, or Set-Location .. to go up one level.
  • Copy-Item – Copies files or folders. Example: Copy-Item C:\temp\file.txt D:\backup\
  • Remove-Item – Deletes files or folders. Be careful: this bypasses the Recycle Bin. Example: Remove-Item C:\temp\old.log
  • Select-Object – Picks specific properties of an object. For instance, Get-Process | Select-Object Name, CPU shows only the name and CPU usage.
  • Where-Object – Filters objects based on a condition. Example: Get-Process | Where-Object {$_.WorkingSet64 -gt 100MB} lists processes using more than 100 MB of memory.

How to Choose What to Learn Next

After you’re comfortable with these ten, you’ll want to expand based on your tasks. If you manage files, learn Move-Item, Rename-Item, and New-Item. If you work with systems, look into Get-EventLog (or Get-WinEvent on newer versions) and Get-CimInstance for hardware info. If you automate repetitive tasks, start learning about variables ($var), loops (foreach), and conditional statements (if/else).

A good rule: whenever you find yourself doing the same thing twice, ask “Can I script this?” That’s when PowerShell becomes truly powerful. But for the first few weeks, focus on the basics—these ten commands will carry you through most simple tasks.

Common Problems and How to Avoid Them

Beginners often run into a few predictable issues:

  • Execution Policy blocks scripts. By default, PowerShell restricts running scripts. You can run commands interactively, but a .ps1 file may fail. Check with Get-ExecutionPolicy; if it’s Restricted, you can set it to RemoteSigned for local scripts (requires admin).
  • Spaces in paths. If a path contains spaces, wrap it in quotes: Copy-Item "C:\My Files\data.txt" "D:\Backup\".
  • Case sensitivity. PowerShell is case-insensitive for commands and parameters, but be consistent for readability.
  • Deleting the wrong thing. Remove-Item doesn’t ask for confirmation by default. Add -Confirm to be prompted, or use -WhatIf to preview what would be deleted.

Comparing PowerShell to Command Prompt

If you’re coming from cmd.exe, the differences are significant. In cmd, dir returns text; in PowerShell, Get-ChildItem returns objects with properties like Name, Length, and LastWriteTime. This means you can do Get-ChildItem | Sort-Object Length -Descending to sort files by size—something that’s painful in cmd.

Also, PowerShell supports aliases for familiar commands: dir works as an alias for Get-ChildItem, cd for Set-Location, and copy for Copy-Item. This eases the transition. However, don’t rely on aliases when writing scripts; use full cmdlet names for clarity.

Safety Tips for Beginners

PowerShell is powerful, and with power comes responsibility. Here are essential safety practices:

  • Always use -WhatIf when testing destructive commands like Remove-Item or Stop-Process. It shows what would happen without actually doing it.
  • Run PowerShell as Administrator only when needed. Many commands work in a standard user context, and elevated sessions have more potential for damage.
  • Be cautious with commands you find online. Understand what they do before running them. A command like Get-Content C:\Windows\System32\drivers\etc\hosts is harmless, but Remove-Item -Recurse C:\ is catastrophic.
  • Keep backups of important files. Even simple copy operations can overwrite existing files if you’re not careful.

Frequently Asked Questions

What is the difference between PowerShell and PowerShell ISE?

PowerShell ISE (Integrated Scripting Environment) is a graphical editor for writing and debugging scripts, while the regular PowerShell console is for interactive commands. ISE is deprecated in newer versions, but you can still use it on Windows 10 and 11. For modern development, consider Visual Studio Code with the PowerShell extension.

How do I list all available commands?

Use Get-Command with no parameters to list every cmdlet, function, and alias. To filter, add a wildcard: Get-Command *process* shows all commands with “process” in the name.

Can I use PowerShell on Mac or Linux?

Yes, PowerShell Core (now just called PowerShell) is cross-platform and runs on macOS and Linux. Most commands work the same, but some Windows-specific ones like Get-Service may have limited functionality.

Why do I get “Access Denied” when running some commands?

Many administrative commands require elevated privileges. Right-click PowerShell and select “Run as administrator” to execute them. Alternatively, use Start-Process powershell -Verb RunAs from an existing session.

What does the $_ symbol mean?

$_ represents the current object in the pipeline. For example, in Get-Process | Where-Object {$_.CPU -gt 100}, $_ refers to each process object as it’s processed. It’s a shorthand for “this item.”

How do I save the output of a command to a file?

Use the redirection operator > or the Out-File cmdlet. For example, Get-Process > processes.txt saves the output as text. To save as CSV, use Export-Csv: Get-Process | Export-Csv processes.csv.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →