Skip to content

Lesson 07 — Windows PowerShell Fundamentals

Lesson 07 — Windows PowerShell Fundamentals

Section titled “Lesson 07 — Windows PowerShell Fundamentals”

Imagine you’re responsible for managing:

  • 2,000 Windows laptops
  • 500 Windows Servers
  • Multiple Azure Virtual Machines
  • Active Directory users
  • Microsoft 365 services

Would you manually configure each system using the graphical interface?

Absolutely not.

Enterprise administrators automate repetitive tasks using Windows PowerShell.

PowerShell is Microsoft’s powerful command-line shell and scripting language designed specifically for system administration and automation.

Whether you’re creating users, restarting services, collecting logs, deploying software, or managing Azure resources, PowerShell helps you perform tasks faster, more consistently, and at enterprise scale.


After completing this lesson, you will be able to:

  • Understand Windows PowerShell.
  • Learn PowerShell architecture.
  • Execute PowerShell commands.
  • Understand cmdlets and objects.
  • Work with variables and pipelines.
  • Create simple PowerShell scripts.
  • Apply PowerShell automation in enterprise environments.

PowerShell is Microsoft’s command-line shell, scripting language, and automation framework.

It is built on the .NET platform and is designed to automate system administration tasks.

PowerShell can manage:

  • Windows
  • Active Directory
  • Microsoft Azure
  • Microsoft 365
  • Hyper-V
  • SQL Server
  • Exchange Server
  • Windows Services
  • File Systems
  • Registry

PowerShell helps administrators:

  • Automate repetitive tasks
  • Reduce manual errors
  • Manage thousands of systems
  • Perform remote administration
  • Build deployment scripts
  • Generate reports
  • Configure enterprise infrastructure

PowerShell is one of the most valuable skills for Windows Administrators and Cloud Engineers.


Command Prompt PowerShell
Text-based output Object-based output
Limited scripting Advanced scripting
Basic administration Enterprise automation
Older Windows tool Modern administration platform

PowerShell is the preferred management tool in modern Windows environments.


Open PowerShell by:

  • Start Menu → Windows PowerShell
  • Windows Terminal
  • Search for PowerShell

Or press:

Win + X
Windows PowerShell

For administrative tasks, launch PowerShell as Administrator.


PowerShell commands are called Cmdlets.

They follow a standard naming convention:

Verb-Noun

Examples:

Terminal window
Get-Service
Get-Process
Get-ChildItem
Start-Service
Stop-Service
Restart-Service

This naming convention makes commands easier to discover and remember.


Display help for a cmdlet.

Terminal window
Get-Help Get-Service

Update help files.

Terminal window
Update-Help

Display examples.

Terminal window
Get-Help Get-Service -Examples

Learning to use the built-in help system is an essential PowerShell skill.


List available cmdlets.

Terminal window
Get-Command

Search for service-related commands.

Terminal window
Get-Command *service*

Search for process commands.

Terminal window
Get-Command *process*

Unlike traditional command-line tools, PowerShell works with Objects instead of plain text.

Example:

Terminal window
Get-Service

Returns service objects containing properties such as:

  • Name
  • Status
  • DisplayName
  • StartupType

Objects make automation far more powerful than text parsing.


Inspect object details.

Terminal window
Get-Service | Get-Member

Display selected properties.

Terminal window
Get-Service | Select-Object Name, Status

Variables store information.

Example:

Terminal window
$name = "GoHackersCloud"
Write-Host $name

Output:

GoHackersCloud

Variables simplify scripting and automation.


PowerShell includes predefined variables.

Examples:

Terminal window
$HOME
$PROFILE
$PSVersionTable

Display PowerShell version.

Terminal window
$PSVersionTable

The pipeline (|) passes objects from one command to another.

Example:

Terminal window
Get-Service | Sort-Object Status

Another example:

Terminal window
Get-Process | Select-Object Name, CPU

Pipelines are one of PowerShell’s most powerful features.


Display only running services.

Terminal window
Get-Service | Where-Object {$_.Status -eq "Running"}

Filter processes using more complex conditions as needed.


Sort processes by CPU usage.

Terminal window
Get-Process | Sort-Object CPU -Descending

Display files.

Terminal window
Get-ChildItem

Equivalent to:

Terminal window
dir

Change directory.

Terminal window
Set-Location C:\Users

Display current directory.

Terminal window
Get-Location

Display processes.

Terminal window
Get-Process

Stop a process.

Terminal window
Stop-Process -Name notepad

Display services.

Terminal window
Get-Service

Restart a service.

Terminal window
Restart-Service Spooler

Display recent system events.

Terminal window
Get-EventLog -LogName System -Newest 20

For newer Windows versions, administrators often use:

Terminal window
Get-WinEvent

Create a file.

hello.ps1

Example:

Terminal window
Write-Host "Welcome to GoHackersCloud Academy!"

Run:

Terminal window
.\hello.ps1

Windows controls script execution using an execution policy.

View the current policy.

Terminal window
Get-ExecutionPolicy

Common values include:

  • Restricted
  • RemoteSigned
  • AllSigned
  • Unrestricted

Organizations should choose an execution policy that aligns with their security requirements.


PowerShell supports remote management.

Example:

Terminal window
Enter-PSSession Server01

Or:

Terminal window
Invoke-Command

Remote administration allows administrators to manage servers without logging in interactively.


Examples include:

Create users:

Terminal window
New-ADUser

Display users:

Terminal window
Get-ADUser

Display groups:

Terminal window
Get-ADGroup

These cmdlets require the Active Directory PowerShell module.


Cloud Engineers use PowerShell to:

  • Create Virtual Machines
  • Manage Storage Accounts
  • Configure Virtual Networks
  • Deploy Resources
  • Manage Microsoft Entra ID

PowerShell is widely used alongside Azure CLI and infrastructure-as-code tools.


Security professionals use PowerShell for:

  • Log Analysis
  • User Auditing
  • Incident Response
  • Malware Investigation
  • Security Automation
  • Threat Hunting

PowerShell is also frequently targeted by attackers, making logging and monitoring especially important.


Display help:

Terminal window
Get-Help

List commands:

Terminal window
Get-Command

Display processes:

Terminal window
Get-Process

Display services:

Terminal window
Get-Service

Display files:

Terminal window
Get-ChildItem

Display current directory:

Terminal window
Get-Location

Display computer information:

Terminal window
Get-ComputerInfo

An administrator needs to check the status of the Print Spooler service on 100 Windows servers.

Instead of manually logging into each server:

PowerShell Script
Connect to Servers
Check Service Status
Generate Report
Email Results
Complete in Minutes

Automation significantly reduces administrative effort and improves consistency.


As a Windows administrator:

  • Learn the Verb-Noun cmdlet naming convention.
  • Use Get-Help before running unfamiliar commands.
  • Test scripts in a lab before production.
  • Use meaningful variable names.
  • Store scripts in version control systems like Git.
  • Apply the Principle of Least Privilege.
  • Digitally sign scripts where required.
  • Enable PowerShell logging and auditing in enterprise environments.

Automation should improve efficiency without compromising security.


After completing this lesson, you should understand:

  • PowerShell fundamentals.
  • Cmdlets.
  • Objects.
  • Variables.
  • Pipelines.
  • Basic scripting.
  • Remote administration.
  • Enterprise PowerShell automation.

PowerShell is the primary automation and administration platform for modern Windows environments.

Its object-based architecture, extensive cmdlet library, and scripting capabilities enable administrators to automate repetitive tasks, manage enterprise infrastructure, and integrate with cloud platforms.

Mastering PowerShell is an essential step toward becoming an effective Windows Administrator, Cloud Engineer, DevOps Engineer, or Cybersecurity Professional.


➡️ Lesson 08 — Windows Networking

In the next lesson, you’ll learn how Windows communicates over networks, understand IP addressing, DNS, DHCP, routing, Windows Firewall, network troubleshooting, and enterprise networking concepts used in corporate environments.