0% found this document useful (0 votes)
9 views24 pages

PowerShell Basics

The document provides an overview of PowerShell, a scripting language for Windows built on .NET, detailing its features, tools, and basic language constructs. It covers command syntax, the help system, pipeline operations, and modules, along with practical lab exercises. The content is aimed at introducing users to PowerShell's capabilities and functionalities.

Uploaded by

gracelia.miranda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views24 pages

PowerShell Basics

The document provides an overview of PowerShell, a scripting language for Windows built on .NET, detailing its features, tools, and basic language constructs. It covers command syntax, the help system, pipeline operations, and modules, along with practical lab exercises. The content is aimed at introducing users to PowerShell's capabilities and functionalities.

Uploaded by

gracelia.miranda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

PowerShell Basics

Adam Driscoll

Adam Driscoll
Twitter: @adamdriscoll
[email protected]
Senior Application Developer
Agenda
• What is PowerShell?
• Tooling
• Language Basics
• Pipeline
• Help System
• Module Basics
• Lab
What is PowerShell?
• Scripting language for Windows
• Available since Windows Server 2008
• Object based pipeline
• Built-on .NET
• Currently at version 5
Tooling
• PowerShell.exe
• PowerShell ISE
• VS Code with PowerShell Extension
• Visual Studio with PowerShell Extension
• PowerShell Studio
• ISE Steroids
Language Basics
• Commands
• Syntax
• Help System
• Pipeline
• Drive System
• Modules
Commands
• Verb-Noun Syntax
• Discoverable
• Parameters
Command Format

Get-Process

Standard Verb Singular Noun

Get-SCSMObject
98 Standard Verbs

Frequently prefixed
Command Parameters

Get-Help about_Parameters
Common Parameters
• -Debug (db)
• -ErrorAction (ea)
• -ErrorVariable (ev)
• -InformationAction
• -InformationVariable
• -OutVariable (ov)
• -OutBuffer (ob)
• -PipelineVariable (pv)
• -Verbose (vb)
• -WarningAction (wa)
• -WarningVariable (wv

Get-Help about_CommonParameters
Parameter Sets
• Defines grouped sets of parameters
• Changes syntax of command based on parameters specified
Parameter Set 1

Parameter Set 2
Command Discovery
Help System
• Get-Help
• Command Based Help
• About Files
• Extensible
• Updatable

Get-Help Get-Help
Variables Value

Variable Name Data Type

Get-Help about_Variables
Strings
Conditional Operators Condition

Expression Body

Get-Help about_If
Comparison Operators

Get-Help about_Operators
Arrays

Get-Help about_Arrays
Get-Help about_ForEach

Loops
Get-Help about_For
Get-Help about_While
Objects
• Objects rather than text
• Objects have properties and methods
• Objects can be formatted, filtered and extended

Get-Help about_Objects
Get-Member
Pipeline
• Chain commands together to perform aggregate operations
• Simply looping statements
• Deal with sets of objects easier

Get-Help about_Pipelines
Aliases
• Shorter syntax for commands
• Can be exported from modules
• Can be defined on the fly
• Many built in aliases

Get-Help about_Aliases
Module Basics
• Modules are collection of commands, formatting files, aliases or
providers
• Can be loaded on demand
• Module installation locations ($Env:PSModulePath)
• Install-Module – PowerShell Gallery

Get-Help about_Modules
Lab
1. Get a list of processes that are using more than 100mb of RAM
2. Display all running services
3. Update the help on your machine. Find and use the command to
display command history in your prompt.
4. List all modules currently installed on your machine.
5. Install a new module from either the PowerShell Gallery or GitHub
6. List all commands available in the module

You might also like