Good Morning and Thank You!. Have some Fun! Learn at least one thing new! Make myself available...

Preview:

Citation preview

Good Morningand

Thank You!

POWERSHELL NOT YOUR FATHER'S COMMAND LINE

10 THINGS YOU NEED TO KNOW

MY PROMISES TO YOU…

Have some Fun! Learn at least one thing new! Make myself available to you

So please … Ask questions and enjoy!

Presented by:

Matthew HesterIT Pro EvangelistMicrosoft Corporation

mhester@microsoft.com@matthewhesterhttp://blogs.technet.com/matthewms

My Boss Martin Schraymartin.schray@microsoft.com

Microsoft Windows Server 2008 R2Administration Instant Reference

WHAT IS POWERSHELL?

Rich script environme

nt

Bulk Operations

Interactive Shell

Task Automatio

n

Object Oriented

WHEN TO USE

Use PowerShell for consistent, repeatable tasks Built-in providers

Talk to Active Directory, registry, WMI, etc. natively Aliases

Bridge the gap for previous languages Tab complete

If it's a good script I'll do it. And if it's a bad script, and they pay me enough, I'll do it.

George Burns

WINDOWS POWERSHELL SYNTAX

Status Name DisplayName------ ---- ----------- Stopped NetLogon NetLogonRunning Netman Network Connections

PS> get-service –name “*net*”

Verb NounName

ArgumentString

Command Parameter

Property Names

Property Values

CAsE InSeNsitIve!*

HOW TO FIND HELP

POWER OF THE PIPE

The Pipe Operator “|” Output from one command becomes input

for the next String together multiple commands

Parameter binding is the key “|” routes information to the correct

parameters – with very little effort

COMMON CMDLETS

Get-HelpGet-Help Get-Process

Get-CommandExample

Get-MemberGet-Service | Get-Member

Restart-ServiceRestart-Service IISADMIN

FormatGet-Service | Format-List

SortingGet-Process | Sort-Object -Property CPU

Redirecting OutputGet-Service | Out-File –FilePath C:\temp\services.txt

Productive cmdlets Utility cmdlets

SECURITY AND WINDOWS POWERSHELL

Policy Effects

Restricted No scripts

AllSigned All scripts must be signed

RemoteSigned Local scripts, remote signed

Unrestricted Nothing signed

Default Execution Policy Is Restricted

Execution Policy Can Be Modified• Set-ExecutionPolicy• Group Policy

REMOTING WITH POWERSHELL

Introduced in v2 Utilizes WinRM (Windows Remote

Management), based on WS-MAN (Web Services for Management)

A PSSession is a persistent connection Interact with sessions 1:1

PROVIDERS

Abstraction of data Provides consistent access (resembles

a file system) Discoverability: Get-PSProvider Write a custom provider

Recommended