PowerShell for Beginner Users
Author(s): Byrch
Last Updated: 07-30-2025
Recommended Prerequisites (click to expand)
None – This guide is for complete beginners. Some familiarity with Windows is helpful.
What is a Commandlet (Cmdlet)?
A cmdlet (pronounced command-let) is a small, single-function command built into PowerShell.
Cmdlets are different from traditional commands because they:
- ALWAYS return objects (not just text).
- Use a consistent verb-noun naming convention.
- Can be combined together using pipelines (|).
Examples:
Get-Help # Displays help info
Get-Process # Lists running processes
Stop-Process # Stops a process
Tip: Cmdlets are case-insensitive.
Get-Processandget-processwork the same.
To see all available cmdlets:
Get-Command
Navigation
PowerShell can navigate your system like the command prompt, but with more features.
Basic navigation commands:
Get-Location(orpwd) → Shows your current directory.Set-Location <path>(orcd <path>) → Change directory.Get-ChildItem(orls) → List files/folders in the current directory.
Example:
Get-Location
Set-Location C:\Windows
Get-ChildItem
Using relative paths:
cd .. # Move up one directory
cd .\Logs # Move into Logs folder
Basic Scripting
PowerShell allows you to write scripts with the .ps1 file extension.
Creating and running a script
- Open Notepad or Powershell ISE (Integrated Scripting Environment).
- Write your PowerShell commands.
- Save as
myscript.ps1. - Run it in PowerShell:
.\myscript.ps1
Important: You may need to change the execution policy to allow scripts:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Variables
$name = "CyberPatriot"
Write-Output "Hello, $name!"
Conditionals
if ($true) { Write-Output "It runs!" }
Loops
# Loop that counts till 5
for ($i = 1; $i -le 5; $i++) {
Write-Output "Number: $i"
}
File Operations
PowerShell makes file management straightforward:
Creating and reading files
New-Item -Path . -Name "notes.txt" -ItemType "File" # Create file
Set-Content notes.txt "This is CyberPatriot!" # Write text
Get-Content notes.txt # Read file
Copying, moving, and deleting files
Copy-Item notes.txt C:\Backups
Move-Item notes.txt C:\Backups
Remove-Item C:\Backups\notes.txt
Working with directories
New-Item -Name "Reports" -ItemType "Directory"
Remove-Item Reports -Recurse -Force
Working with many files recursively
Get-ChildItem -Recurse -Force -File
Pipelines (Power of PowerShell)
You can pass the output of one cmdlet to another using |:
Get-ChildItem -Recurse -Force -File | Where-Object {$_.Extension -eq ".mp3"}
This command finds all the files in the current directory with the extension *.mp3
Fun Commands (Power of PowerShell)
You can find the checksum of a file using:
Get-FileHash -Algorithm MD5 -Path "/file/path/here"
Want to secure a plaintext string? You can use the following to convert it to encrypt and store strings securely (this will come in handy later):
"mypassword" | ConvertTo-SecureString -AsPlainText -Force
Don't know what a command-let does? You can view the parameters and other capabilties using another command-let:
Show-Command Get-LocalUser