2014 spiceworld london breakout

28
Bringing Home The Bacon An Introduction to Windows PowerShell Thomas Lee Partner, PS Partnership

Upload: thomas-lee

Post on 15-Jan-2015

268 views

Category:

Technology


2 download

DESCRIPTION

Bringing Home The Bacon With PowerShell - Why PowerShell Matters to IT Pros. This talk looked at the basics of PowerShell, and what it contains and examines why it is important to IT Pros. There was also a short demo.

TRANSCRIPT

Page 1: 2014 SpiceWorld London Breakout

Bringing Home The Bacon

An Introduction to Windows PowerShellThomas LeePartner, PS Partnership

Page 2: 2014 SpiceWorld London Breakout

Bringing Home The Bacon

• Bacon and PowerShell• What IS PowerShell?• What are Cmdlets, Objects and The Pipeline?• PowerShell in Windows• PowerShell in Windows Applications• Why PowerShell Matters to YOU• Questions

Page 3: 2014 SpiceWorld London Breakout

PowerShell and Bacon

• PowerShell is the future of Windows administration• PowerShell makes your life easier• PowerShell magnifies your effort• With PowerShell you have more time to enjoy and

consume bacon• Let me show you how and why!

Page 4: 2014 SpiceWorld London Breakout

But First - What IS PowerShell?

• Microsoft’s Task Automation Platform for IT Pros• It contains– Shell – think Unix like in terms of usefulness– Scripting Language – with the power of Perl or Ruby – Extensible – bring on the community

• Based on .NET – Microsoft focused

Page 5: 2014 SpiceWorld London Breakout

Looking at PowerShell

Cmdlets Objects Pipeline

Community

Discovery

PowerShell Language Features

Page 6: 2014 SpiceWorld London Breakout

What are Cmdlets?

• A unit of functionality • Implemented as a .NET Class– Get some with PowerShell/Windows– Buy some – eg /n Software’s NetCmdlets– Find some – leverage the community efforts– Build your own – use C# and VS

Page 7: 2014 SpiceWorld London Breakout

Cmdlets (continued)

• Cmdlets named with a Verb-Noun syntax– Verbs are standard to aid discovery

• Cmdlets can have aliases– Built in or add your own– Aliases do NOT include parameter aliasing

• Cmdlets come from PowerShell, Windows, apps

Page 8: 2014 SpiceWorld London Breakout

Cmdlets (continued)

• Cmdlets take parameters• All parameters have parameter names– Begin with a ‘-’

• Some parameter names can be omitted• Tab completion is your friend!• Cmdlets are discoverable – Get-Help, Get-Command

Page 9: 2014 SpiceWorld London Breakout

Cmdlets and Modules

• Cmdlets/Functions packaged into modules• Modules can be dynamically loaded• You can develop your own modules

Page 10: 2014 SpiceWorld London Breakout

What are Objects?

• A computer abstraction of a real life thing– A process– A server– An AD User

• In PowerShell everything is an object

Page 11: 2014 SpiceWorld London Breakout

Objects (continued)

• Objects have occurrences you manage– The processes running on a computer– The users in an OU– The files in a folder

• Objects dramatically simplifies scripting

Page 12: 2014 SpiceWorld London Breakout

PowerShell Object Support

• PowerShell supports:– .NET objects– COM objects– WMI objects– Custom Objects

• Syntax and usage vary – similar, yet different

Page 13: 2014 SpiceWorld London Breakout

Objects in PowerShell

• Cmdlets produce and consume objects– E.g. Get-Process produces objects of the type

System.Diagnostics.Process• Objects are discoverable– Get-Member tells you the what an object contains

• Refer to MSDN documentation for more detail

Page 14: 2014 SpiceWorld London Breakout

What Is The Pipeline?

• The pipeline connects cmdlets– One cmdlet outputs objects– Next cmdlet uses them as input

• Pipeline is not a new concept– Came From Unix/Linux– PowerShell Pipes objects not text

Page 15: 2014 SpiceWorld London Breakout

Why This Design Matters

• Simple to use – far easier to compose• Powerful in operation - PowerShell (and .NET)

do the heavy lifting• Improves integration of functionality stacks– OS/Application/PowerShell base/Community

efforts/etc

Page 16: 2014 SpiceWorld London Breakout

Discovery

• A key concept in PowerShell• What you know helps you learn more• PowerShell built to be discoverable

Page 17: 2014 SpiceWorld London Breakout

Demo Time

• Cmdlets• Pipeline• Objects

Page 18: 2014 SpiceWorld London Breakout

PowerShell Community

• You never walk alone => there is a HUGE PowerShell ecosystem– Spiceheads– Product teams– Vendors

• Various ways to engage with the community– Spiceworks PowerShell Group– Blogs– Twitter

Page 19: 2014 SpiceWorld London Breakout

PowerShell Language

• PowerShell has a language• This is used to create scripts, script cmdlets, etc.• Syntax similar to C#, et al• Language contains features from Unix/Linux

and a bunch of others• You need to know the language to write scripts

Page 20: 2014 SpiceWorld London Breakout

PowerShell ISE

• A richer environment• Does colour coding of syntax• Good editing features• Extensible

Page 21: 2014 SpiceWorld London Breakout

PowerShell is Everywhere

• Core modules come with Windows• Additional modules come with windows

features• More module come with Windows apps• Even more modules come from the community

Page 22: 2014 SpiceWorld London Breakout

How Do I Get PowerShell?

• V3 Built into Win8, Server 2012• V4 Built into Win 8.1, Server 2012 R2• V5 in beta

Page 23: 2014 SpiceWorld London Breakout

So Why Does PowerShell Matter?

• Because it’s everywhere!• It’s faster for repetitive tasks• It’s repeatable and auditable• Less prone to error

Page 24: 2014 SpiceWorld London Breakout

Learning PowerShell

• Books/blogs/forums• Microsoft and other Training Courses• Cheap plug – come on my weekend

PowerShell PowerCamps – next one is in October

• Get your company to sponsor a class

Page 25: 2014 SpiceWorld London Breakout

So What Next?

• First, remove cmd.exe from your system– Use PowerShell everywhere

• Use PowerShell for as much as you can– Ask questions on Spiceworks

• Master PowerShell– And bring home the bacon

Page 26: 2014 SpiceWorld London Breakout

Summary

• If you are an IT Pro in the Windows space you need to either– Learn PowerShell– Learn how to smile when you say ‘would you like

fries with that’

Page 27: 2014 SpiceWorld London Breakout
Page 28: 2014 SpiceWorld London Breakout