POWERSHELL

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/41

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

42 Terms

1
New cards

shell

is a user interface for accessing the operating system's services. It interprets and executes commands entered by the user.

2
New cards

Two types of shell:

- Command-line Shell (e.g., CMD, Bash)

- Graphical Shell (e.g., Windows Explorer)

3
New cards

PowerShell

- A modern command-line shell. Built on the .NET Framework. Accepts and returns .NET objects. Designed for task automation.

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

4
New cards

Key PowerShell Features

- Command-line history & tab completion.

- In-console help.

- Pipeline for chaining commands.

- Alias and object support.

5
New cards

PowerShell vs. Command Prompt

- PowerShell: Object-based.

- CMD: Text-based.

- PowerShell supports scripting and automation.

6
New cards

PowerShell Architecture

- Based on .NET CLR.

- Works with .NET objects.

- Extensible via modules and classes.

7
New cards

Launching PowerShell

- Start Menu → Windows PowerShell.

- Use Run or CMD: PowerShell or PowerShell ISE.

8
New cards

PowerShell Console

For direct command input.

9
New cards

Powershell ISE

For writing, testing, and debugging scripts

10
New cards

Arrow Keys

Navigate History

11
New cards

F7

Shows History list

12
New cards

Tab

Auto-complete commands

13
New cards

Cmdlets Overview

- PowerShell commands = Cmdlets.

- Use Verb-Noun format (e.g., Get-Process).

- View all: Get-Command.

- Get-Command -Verb Get

14
New cards

Get-Help

shows command info.

Use -Examples to see usage.

- Example:

- Get-Help Get-Service -Examples.

- Get-Help Get-SystemDriver -Examples

15
New cards

Get-Process

View running processes.

16
New cards

Get-Service

View services.

17
New cards

Get-Location

Show current directory.

18
New cards

Aliases

shorthand for cmdlets.

Example:

- New-Alias listDir Get-ChildItem

19
New cards

Get-Alias

View all aliases.

20
New cards

New-Alias

Hist Get-History

- Example:

•New-Alias listDir Get-ChildItem

21
New cards

-WhatIf

Preview results.

22
New cards

Confirm

Ask before executing.

23
New cards

-Verbose, -Debug

Detailed output.

24
New cards

Cmdlet Parameters

Example:

- Stop-Process -Name notepad -WhatIf

25
New cards

Working with Objects

- Cmdlets return objects.

- Use Get-Member to explore properties/methods.

- Example: Get-Service | Get-Member.

26
New cards

Output Formatting

Format-Table, Format-List, Format-Wide.

- Example: Get-ChildItem | Format-Table -AutoSize.

27
New cards

Exporting Data

- ConvertTo-Html: Create HTML output.

- Export-CSV: Save to .csv file.

- Invoke-Item: Open exported file.

- Example:

- Get-Process | Export-Csv -Path C:\Processes.csv

28
New cards

ConvertTo-Html

Create HTML output.

29
New cards

Export-CSV

Save to .csv file.

30
New cards

Invoke-Item

Open exported file.

31
New cards

PowerShell Providers

Access data like file system or registry.

32
New cards

Get-PSProvider

Lists Providers

33
New cards

Get-PSDrive

View Drives

34
New cards

Certificate Provider

- Use Set-Location cert:: to browse certificates.

- Export using Export-CSV.

- Example:

- Get-ChildItem cert:: | Export-Csv C:\certs.csv

35
New cards

PowerShell Scripting Basics

- Supports variables, arrays, hashtables.

- Use operators, loops, conditions, functions.

36
New cards

Variable Types

- [int], [string], [bool], [xml], etc.

- $x = 5, $name = 'PowerShell'.

37
New cards

$_

Current pipeline object.

38
New cards

$Args

Arguments to function.

39
New cards

$PsHome

PowerShell install path.

40
New cards

Conditional Logic

- Use if, elseif, else for decision making.

- Switch: Handle multiple cases.

- Example:

- if ($x -eq 5) { Write-Host "Five" }

41
New cards

Writing Functions

- Function Greet { Write-Host 'Hello' }

- Use $args to pass input values.

42
New cards

PowerShell Pipeline

- Use | to chain commands.

- Example: Get-Process | Where { $_.Handles -gt 500 } | Sort Handles | Format-Table

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