MSDN Documentation

Getting Started with PowerShell

Welcome to PowerShell, a powerful, cross-platform automation and configuration management framework built on the .NET framework. This guide will walk you through the essential steps to begin your journey with PowerShell.

What is PowerShell?

PowerShell is a task-based command-line shell and scripting language designed for system administration. It leverages the concept of cmdlets (pronounced "command-lets"), which are specific .NET classes designed to perform common administrative tasks.

Key Concepts

Your First PowerShell Commands

Let's run some basic commands to get a feel for PowerShell. You can open PowerShell by searching for "PowerShell" in your Start Menu or by running powershell.exe from an existing command prompt.

1. Checking the PowerShell Version

It's always a good idea to know which version you're running.

> $PSVersionTable.PSVersion

This will output something like:

Major  Minor  Patch  PreRelease Label BuildDate
-----  -----  -----  ---------- ----- ---------
5      1      22621  1850       NULL  2023-05-24

2. Getting Information about Processes

Use the Get-Process cmdlet to list running processes.

> Get-Process

To filter for a specific process, like your web browser:

> Get-Process -Name chrome

3. Navigating the File System

PowerShell treats drives like items you can navigate. Use Get-ChildItem (or its alias ls or dir) to see files and folders.

> Get-ChildItem

To change directory:

> Set-Location C:\Users

And to go back:

> Set-Location ..

4. Using the Pipeline

The pipeline allows you to chain commands. Let's find all running processes that consume more than 100MB of memory.

> Get-Process | Where-Object {$_.WS -gt 100MB}

The Where-Object cmdlet filters the objects passed from Get-Process.

Next Steps

This is just a brief introduction. To deepen your understanding, explore the following topics: