Example Excerises
Last updated
Was this helpful?
Last updated
Was this helpful?
ISE (Integrated Scripting Environment): A GUI for writing and debugging PowerShell scripts.
Everything in PowerShell is an OBJECT ✅
Check PowerShell version:
Ping a website:
Videos Used:
Cmdlet format: Verb-Noun
(unless it's a custom function).
Check execution policy:
Change execution policy:
RemoteSigned
allows custom scripts to run.
Print text:
Find commands:
Get help for a command:
Write to a file:
View file content:
Create a variable:
Output a variable:
Save variable to a file:
Find variable type:
List all properties:
List all methods:
Define an array:
Get first element:
Add an element:
Define a hashtable:
Add an entry:
Prompt for user input:
If-Else Example:
ElseIf Example:
For Loop:
ForEach Loop:
While Loop:
Define a function:
Using Try-Catch:
Create a file:
Move a file:
Delete a file:
Import Active Directory Module:
Get a user:
Create a new AD user:
Use Clear-Host
to clear the console screen.
Use Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 10
to find top 10 memory-consuming processes.