Meet Windows PowerShell

Preview:

DESCRIPTION

 

Citation preview

MEET W

INDOW

S

POW

ERSHELL!

( NO

MA

T TE

R W

HO

YO

U A

RE

)

This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it

within your own organization however you like.

For more information on our company, including information on private classes and upcoming conference appearances, please

visit our Web site, www.ConcentratedTech.com.

For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg

This work is copyright ©Concentrated Technology, LLC

INTRODUCTIONS

Don Jones Senior Partner and Principal Technologist, Concentrated Technology

www.ConcentratedTech.com

Windows PowerShell MVP Award Recipient

Blogger at WindowsITPro.com

Columnist for Microsoft TechNet Magazine and Redmond Magazinewww.TechNetMagazine.com • www.RedmondMag.com

Windows PowerShell instructor and enthusiast

Learn Windows PowerShell in a Month of Lunches

Also available: Companion DVD and Web siteMoreLunches.com

GET THE BOOK!

You can order an autographed version when we’re done today, and it’ll be shipped right to you in about a week

MEMES WE’LL COVER

What is PowerShell, and Why Should You Care?

PowerShell: Command-Line Interface or Scripting Language?

PowerShell Patterns and Practices(Learn these and you’ll never need another class)

Turning Commands into Reusable Tools

OUR GOAL

To expose you to many of PowerShell’s core patterns and practices

With this information, you can start to “figure out” PowerShell largely on your own!

This is definitely a “crash course,” so prepare your airbags for rapid deployment

We will be covering a good amount of material very quickly – the goal is to give you an idea of what PowerShell does and how it does it, not to make you an expert

If you’d like a somewhat slower-paced, methodical introduction… Learn Windows PowerShell in a Month of Lunches!Or consider an instructor-led class (MOC 10325A or have me on-site)

BEFORE WE GET STARTED…

Ask Questions!

Challenge Assumptions!

Share Your Experiences!

This is going to mostly involve demos, not slides. You can get a recorded full-day workshop on DVD from http://ConcentratedTech.com/DVDGoPack.php if you miss anything or need a reminder

If you lose any of the URLs, just visit ShellHub.com – I have them all listed there

This deck is downloadable at ConcentratedTech.com/download

What is Windows

PowerShell, and Why Should You

Care?

THE STRATEGIC OUTLOOK

Microsoft produced PowerShell because of customer demand for better administrative automation capabilities.

In other words, management cares about efficiency. Who knew?

Learn PowerShell = Be Efficient = Keep Job

Ignore PowerShell = Keep Clicking Through Dialog Boxes = Fries With That?

SYSTEM REQUIREMENTS

Windows 7 / Windows Server 2008 R2 (incl Core): Installed by default

Windows Vista / Windows Server 2008: Has v1; Needs v2

Windows XP / Windows Server 2003: Has nothing, Needs v2

Requires .NET Framework v2 (v3.51 is better; can live side by side with v4)

To get PowerShell v2: Search for “Download Management Framework Core”

CAUTION / GOTCHA ALERT

On 64-bit operating systems, you get four PowerShells:

• Console and ISE in 64-bit form

• Console and ISE in 32-bit form - window says “(x86”)

Shell extensions can only run in a matching architecture (e.g., 32-bit extension runs in x86 shell). Don’t mess this up.

Also make sure window title bar says “Administrator,” or you aren’t administrator.

Is it a CLI?Or a Scripting

Language?

Hint: If you can run Dir | More,

you can use PowerShell.

REALLY, IT’S THIS EASY

Get-Mailbox | Sort Size –descending | Select –first 100 | Move-Mailbox –Server FOO

Ok, that isn’t the 100% syntax… but it’s close, and it gives you an idea of what PowerShell is. Sure, you can treat it like a VBScript replacement… but isn’t this much more cool?

The tricky bit is that different audiences tend to approach PowerShell in different ways. Scripters use it to write scripts. Devs use it like “C# lite.” Admins shouldn’t be distracted by those approaches if they’re not appropriate – use it like a shell.

LET THE DEMOS BEGIN

Enough with the slides. Let’s do this.

Start thinking: What would you like to be able to do in Windows PowerShell?Ask me how – I’ll at least tell you, and if I can, I’ll show you. Right now.

PATTERNS AND PRACTICES

1. Finding commands by using Help and Get-Command

2. Loading new commands (extending the shell)

3. Cmdlet naming conventions

4. Why (almost) everything is a disk drive

5. Parameters and Interpreting the Help

6. Core cmdlets: Sorting, Filtering, Selecting, and More

7. Pipeline Parameter Binding (ByValue and ByPropertyName)

8. Working with Windows Management Instrumentation

9. Adding custom columns (properties)

10.Ways of feeding computer names to a –computerName parameter

BUILDING REUSABLE TOOLS

While cmdlets are written in C# or Visual Basic…

…you can do something awfully close in an advanced function using PowerShell’s scripting language

Let’s take a fairly simple pair of commands and turn them into the ultimate re-usable tool, all from scratch. We’ll inventory OS, service back, and BIOS information from multiple computers

Then we’ll do it with a command that clears the application log on one or more computers – and implements some more PowerShell patterns and best practices

SUMMARY Start learning PowerShell. Find a task to automate and dive right in.

Focus on patterns and practices to teach yourself.

We

real

ly d

id c

over

a lo

t of s

tuff, d

idn’t

we?

THANK YOU!

Thanks to all the local folks who helped make this seminar happen…

…and thanks to Microsoft IT Pro Evangelist Harold Wong, who had the idea!

Remember, you can get this deck at ConcentratedTech.com/download

Any last questions????

Learn Windows PowerShell in a Month of Lunches

Also available: Companion DVD and Web siteMoreLunches.com

REMEMBER!

You can order an autographed version today, and it’ll be shipped right to you in about a week!

MY CONTACT INFORMATION

Q&A: http://connect.ConcentratedTech.com

Twitter: @concentrateddon

LinkedIn: http://linkedin.com/in/concentratedDon

Or send a text message containing DONJ to 50500 – you’ll get a reply with my contact info and a vCard link

Private On-Site Training Available – contact sales@concentratedtech.com.Flat-rate pricing includes travel expenses (3-5 day classes)

Get this deck from ConcentratedTech.com/download

Look for “Jones-2011WestCoastTour.zip”

GO FORT

H AND S

HELL!

( BE

FO

RE

V3

CO

ME

S O

UT

AN

D A

DD

S A

BU

NC

H O

F S

TU

FF

)

This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it

within your own organization however you like.

For more information on our company, including information on private classes and upcoming conference appearances, please

visit our Web site, www.ConcentratedTech.com.

For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg

This work is copyright ©Concentrated Technology, LLC

Recommended