Basic

Some key commands for learning powershell.

Object-based pipeline vs Text-based Pipeline

 Book "Pro Windows Powershell" Chapter 3

 http://techbus.safaribooksonline.com/9781590599402

New in Powershell 2 (Windows Remote Management - WinRM)

Additionals tools

Stuff 

Variables

get-help *variable*

Built-in Variables

get-variable

$env:path

$foo = "blah"

[string]$foo = "blah"

$foo | gm

$a=8

$a.gettype()

$a | gm

Array

get-help array | more

$b = 1,2,3,"blah"

$b.gettype()

Hashes

get-help hash | more

$hash=@{'Home'="123 main street";'Work'="456 Blah Ave"}

$hash

$hash['Work']

Objects

    properties

    methods

    events

Examples

Get-ExecutionPolicy

Set-ExecutionPolicy

get-eventlog -newest 10 

get-process

$c = 1..10 (.. range operator)

$c

$c | foreach {$_ * 2}

Fancy

Get-PSProvider

cd hklm:

Get-Command cd

get-command c:

Set-Location hklm:

cd function:

dir

function env: {Set-Location env:}

Get-Content Function:\TabExpansion

env:

dir (gci)

measure-command

measure-object

Get-WmiObject win32_logicaldisk | gm

Get-WmiObject win32_logicaldisk | select DeviceID, Compressed

$cred = Get-Credential

Get-WmiObject -ComputerName server01 -Credential $cred win32_logicaldisk | select DeviceID, __SERVER, Compressed

Cmdlets 

Get-Help

how to read (syntax)

-full

-examples

Get-Help * -Parameter credential

Get-Help * -Parameter asjob

Get-help about

Get-help get-p

Get-Help -Online Get-Member

 

get-help about_Comment_Based_Help

Get-Command

get-command dir

get-command Get-ChildItem

Get-Command select

Get-Command -CommandType function

get-command -verb get

get-command -noun job

Get-Member (gm)