Slide 1 - Huddled Masses

burnwholeInternet and Web Development

Feb 5, 2013 (4 years and 2 months ago)

292 views


Joel Bennett

HuddledMasses.org



What is Power Shell?


How can it help me?


Should I code for
it?


How

do I …

What is PowerShell?


PowerShell is a
.Net

________

What is PowerShell?


PowerShell is a
.Net

________

What is PowerShell?


PowerShell is a
.Net

________

What is PowerShell?


PowerShell is a
.Net

________

What is PowerShell?


PowerShell is a
.Net

________

What is PowerShell?


PowerShell is a
.Net

________


PowerShell v1 is a Windows
Patch


On Windows XP (and Server 2008)


PowerShell v2 is in CTP


Will be
included by default
in Windows 7


And in Server 2008 R2


CEC 2009


Support in every new server product


Exchange, SQL,
VMWare
, etc..


Bonus

Slide

Think "
DOS.Net
"


A Command Shell you know


cd
, dir,
mkdir
, move…
ls
,
mv
,
ps




Enhanced output


Enhanced pipeline


Top
-
notch discoverability


Extensible, Provider
-
based navigation

Or “bash”
.Net
, if you prefer.

Command
-
Line Standard

http://
microsoft.com
/technet/scriptcenter/topics/
winpsh/
cmdline_std.mspx


Cmdlets

(
commandlets
)


Verb
-
Noun
-

singular form


Get
-
Command, Get
-
Help, Get
-
Member, Select
-
Object, Where
-
Object, Format
-
Table, ...


More on these later …


Functions and Scripts


Aliases

The Object Pipeline


Everything is an Object (Even Text)


Commands output objects


Commands accept pipeline input


Formatting and output


Out
-
* and Format
-
*
cmdlets


Format.ps1xml

Common Commands (DOS and Bash)

Ruby and Perl, WMI and COM (??)

Get
-
Command (Verbs and Nouns)

Get
-
Help and Get
-
Member

Pipelines!

Bonus Demo: Providers


Active Directory


Exchange


SQL Server


IIS 7


CEC 2009



Windows 2008 R2


Windows 7


SCOM 2007


SCVMM


Administration & Automation



Language


RAD Development


Target Platform


Test Framework


Automation Engine

A
.Net

Language


Dynamic Language


Dynamic variables and scope


Superb casting (too superb)


Extensible Type System


Full access to
.Net


Built
-
in Reflection

A Scripting Language


Interpreted


Best WMI scripting experience


COM
interop

and automation


Full access to
WinForms

and WPF


Second
-
Class
.Net

Citizen?


Cannot do
Interop

(in v1)


Cannot create new classes (easily)


RAD Prototyping


Focus on the Algorithm


Develop in Script


Iterative and Interpreted


Develop in Code


Test and Play in script


No UI overhead


Input and Output handled by PowerShell

Bonus

Slide

Testing (unit and otherwise)


Run *Unit tests in
Gallio


MSTest
,
NUnit
,
MbUnit
,
xUnit
,
csUnit
,
Nbehave



Write Tests straight in PowerShell


Or test interactively…


Add
-
Type
-
Path


[
Reflection.Assembly
]::
LoadFrom
( … )


Scripting (it's
.Net
, silly)


With the right
cmdlets


You can automate anything…


With the right libraries


you can craft your own
cmdlets


WASP

and
White


HttpRest

and
Dream




Functions (in 2.0)


PowerShell 2.0 (CTP3 release is “
soon
”)


Functions become full
cmdlets


Pipeline parameters


Parameter sets


Script Modules provide isolation


Public and Private functions


Public and Private member variables


Cmdlets

(so easy, a caveman...)


Just inherit from
Cmdlet

or
PSCmdlet


Decorate your class


[
Cmdlet
(
VerbsCommon.Get
, "Noun“)]


Decorate your properties


[Parameter(Position = 0,
ParameterSet
="Name"


ValueFromPipeline
ByPropertyName

= true)]


Override
ProcessRecord
()


BeginProcessing
,
EndProcessing
,
StopProcessing

Providers (Containers, Items,
and Properties, oh my)


When you want to implement navigation


FileSystem
, Registry, Variable, Function, Alias


Feeds, SQL Server, IIS, …


When you want to implement content


Custom settings providers (PSCX)


Background Jobs


Certificates …

Hosting (automation engine)


Host PowerShell in your application


Expose your objects to it!


Provider users the ability to script


Limit and control what they can bring in.


Demo (
PoshConsole

and “Logo”)

Resources

PowerShell Community

blogs.msdn.com/PowerShell

irc.freenode.net #PowerShell

PowerShell Newsgroup

Connect.Microsoft.com

HuddledMasses.org


PowerTab


PoshConsole


Graphical PowerShell (v2.0)


PowerGUI


PowerShell Plus


PrimalScript