Week 1: Introduction to Windows Scripting and PowerShell
Week 1 — Introduction to Windows Scripting and PowerShell
What you will learn this week
- What Windows scripting is and why it matters
- How PowerShell differs from older scripting tools
- How to install and configure PowerShell
- The basic structure of a PowerShell command (cmdlet)
- How to navigate the file system from the command line
1. What is Windows Scripting?
Windows scripting is the automation of tasks on the Windows operating system using a scripting language. Instead of clicking through menus repeatedly, you write a script — a file containing a series of commands — and let the computer do the work.
Why use scripting?
- Automation — removes repetitive manual steps, saving time and reducing errors
- Consistency — the same script produces the same result every time
- Efficiency — scripts can complete complex tasks far faster than manual work
- Scalability — one script can manage one machine or one thousand
Common scripting languages in Windows
| Language | Notes |
|---|---|
| Batch (.bat) | Legacy Command Prompt scripts; limited capability |
| VBScript / JScript | Older languages run by Windows Script Host; largely deprecated |
| PowerShell | Modern, object-oriented; the current standard for Windows automation |
2. What is PowerShell?
PowerShell is a task automation and configuration management framework consisting of a command-line shell and an associated scripting language built on .NET. Microsoft released it in 2006 to replace older tools like the Command Prompt and Windows Script Host.
Key characteristics
- Object-oriented — commands pass structured objects, not plain text
- Cross-platform — available on Windows, Linux, and macOS (PowerShell 7+)
- Extensible — thousands of community and vendor modules available
- Integrated — deep hooks into Windows, Azure, Active Directory, and more
PowerShell versions
| Version | Notes |
|---|---|
| Windows PowerShell 5.1 | Ships with Windows 10/11; .NET Framework |
| PowerShell 7+ | Cross-platform; .NET Core; recommended for new work |
3. Installing and Configuring PowerShell
Check if PowerShell is installed
Open the Start menu, search for PowerShell, and launch it. You can also type powershell in any Command Prompt window.
Install PowerShell 7 (optional upgrade)
Download the latest release from the official GitHub repository:
https://github.com/PowerShell/PowerShell
Set the execution policy
By default, PowerShell blocks script execution as a security measure. To allow locally written scripts to run:
Set-ExecutionPolicy RemoteSigned
Common policies:
| Policy | Meaning |
|---|---|
Restricted |
No scripts allowed (default on many systems) |
AllSigned |
Scripts must be signed by a trusted publisher |
RemoteSigned |
Local scripts run freely; downloaded scripts must be signed |
Unrestricted |
All scripts run; internet scripts prompt a warning |
Requires an Administrator PowerShell window.
4. Basic Command Structure
PowerShell commands are called cmdlets (pronounced command-lets). They follow a strict Verb-Noun naming pattern:
Get-Process # Verb: Get | Noun: Process
Set-ExecutionPolicy
New-Item
Remove-Item
Copy-Item
Parameters customise the cmdlet's behaviour:
Get-Process -Name "notepad" # named parameter
Get-Process notepad # positional parameter (same result)
Pipelines chain cmdlets — the output of one becomes the input of the next:
Get-Process | Sort-Object -Property CPU
5. Common Starter Cmdlets
| Cmdlet | Alias | Purpose |
|---|---|---|
Get-Help |
help |
Display help for any cmdlet |
Get-Command |
gcm |
List available cmdlets |
Get-Process |
gps |
List running processes |
Set-Location |
cd |
Change directory |
Get-ChildItem |
ls, dir |
List directory contents |
New-Item |
Create a file or folder | |
Remove-Item |
Delete a file or folder | |
Copy-Item |
Copy a file or folder | |
Move-Item |
Move or rename a file or folder |
Summary
- PowerShell is Microsoft's modern scripting and automation shell, built on .NET.
- Cmdlets follow the Verb-Noun pattern and accept named or positional parameters.
- The pipeline passes objects between cmdlets, enabling powerful one-liners.
- Always set an appropriate execution policy before running scripts.