Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PowerShell Tutorial

PowerShell Tutorial

PowerShell (including Windows PowerShell and PowerShell Core) is a cross-platform command-line tool and scripting language developed by Microsoft, built on the .NET framework. It

PowerShell consists of a command-line shell and an associated scripting language built on the .NET Framework and later .NET. It was originally a Windows-only component, then open-sourced on August 18, 2016, providing cross-platform support.

PowerShell is object-oriented, meaning it handles .NET objects rather than plain text.


Who should learn PowerShell?

PowerShell is suitable for technical staff who need to efficiently manage Windows systems, automate repetitive tasks, or interact with Microsoft products (such as Active Directory, Azure, Exchange, etc.), including system administrators, IT operations, developers, and security engineers.

The core advantage of PowerShell is converting graphical click operations into reusable script commands, making it especially suitable for batch operations and scheduled tasks.

Ordinary users who only need basic computer operations do not need to learn PowerShell.


Why do we need PowerShell?

In the UNIX world, command-line shells such as bash, zsh, and sh have long been standard tools for developers and operations staff. However, Windows originally only had the limited cmd.exe, lacking scripting capability, modular support, and object handling.

PowerShell was created precisely to fill the gaps of Windows in automation and command-line control, and now, having left Windows behind, it has become a truly cross-platform automation tool.

PowerShell core features

  1. Object-oriented - Commands output objects (such as processes, files) rather than plain text.
  2. Pipeline - Supports object passing and can process data in a chain.
  3. Unified naming convention - Uses the 动词-名词 format (such as Get-Process).
  4. Cross-platform support - Can run on Windows, Linux, and macOS (PowerShell Core).
  5. Deep .NET integration - Can directly call .NET class libraries and methods.
  6. Modular Design - Functionality is extended via modules (such as the ActiveDirectory module).
  7. Automation scripts - Supports complex scripting (variables, loops, functions, etc.).
  8. Remote management - Through Enter-PSSession or Invoke-Command to manage remote machines.
  9. Alias system - Supports shorthands (such as ls replaces Get-ChildItem).
  10. Powerful help system - Built-in Get-Help and example code.

In a nutshell: PowerShell is an object-oriented automation tool designed for efficient system management and cross-platform tasks.


PowerShell Getting Started Examples

Example

Get all running processes

Get-Process

Get detailed information about a specific process

Get-Process

-Name

"notepad"

|

Select-Object Name, CPU, WorkingSet

Stop a specific process

Stop-Process

-Name

"notepad"

-Force


Related Resources

Official documentation:https://docs.microsoft.com/powershell/