PowerShell 101

The Basics

Help System

Command Discovery

Verb-Noun

Running Commands

Will Cover

Variables, Types

Pipeline, Switch

String Format

Functions, etc.

May Cover

Getting Help

RTFM - Right?

Get-Help

Get-Help <command>

 

Additional Options

-examples

-detailed

-full

-online?!?

Too Much?

get-help <command> | more

get-help <command> | less  

 

CTRL + C    break's out

Demo

man

for the Linux guys

 

Demo

online

Let's Play a bit...

Finding Commands

Get-Command

Basic Search

Get-Command get*

 

 

Additional Options

-noun

-verb

-ShowCommandInfo
-ParameterName

-Syntax

Demo

Let's Play a bit...

Grammar Matters

It's simple

Verb-Noun

 

Don't use more dashes - just don't --- okay!

get-verb is your friend!

 

e.g.

get-help

get-command

get-childitem (ls)

Does it really matter?

Beginners: Nope

Beyond That: Yep!

 

Good habit, small adjustment

 

It matters a ton, when we develop functions and modules

You can build your own help

PowerShell will index it correctly, for use in get-help

Let's Play a bit...

Running Commands

PowerShell
ISE
VS Code = :)

PowerShell

Run commands directly

Script files  .\<script>.ps1

Right-Click - Run w/ PoSh

Tab-Completion

Host Interaction: Text

Task Scheduler

 

ISE

Integrated Host / Console

Debugging

Command Lookup

Tabbed Interface

Tab-Completion

Host Interaction: GUI

VS Code!

The new ISE

 

VSC Integration

Folder "projects"

Tabbed Editing

Multi-Window

Tab-Completion

Integrated Terminal

Debugging

Command Progression

  • CmdLet (get-help)
  • One-Liners
  • Multi-Line - start to use variables
  • Script File - not a function
  • Script File - takes parameters
  • Import-Module + run a function / cmdlet
  • Write your own functions / modules

Let's Play a bit...

PowerShell 101

By Ken Maglio

PowerShell 101

PowerShell 101 - The Basics

  • 700