Windows PowerShell Crash Course Don Jones Concentrated Technology Jeffrey Snover Microsoft WSV321.
-
Upload
brendon-penner -
Category
Documents
-
view
225 -
download
0
Transcript of Windows PowerShell Crash Course Don Jones Concentrated Technology Jeffrey Snover Microsoft WSV321.
Windows PowerShellCrash Course
Don Jones • Concentrated TechnologyJeffrey Snover • Microsoft
WSV321
Welcome!
We’re here to get you up and running with PowerShell – as quickly as possible.99% of what you’ll see applies to v2 and v3; we’ll point out some specific v3 coolness as we goPlease ask questions as we go, although we are on a tight schedule, so some stuff we may need to pick up at the end.
Quick Introductions
Don JonesPowerShell MVP Award RecipientPowerShell columnist for TechNet MagazineAuthor, Learn Windows PowerShell in a Month of Lunches and PowerShell in Depth (forthcoming)
Jeffrey SnoverDistinguished Engineer in the Windows Server teamInventor of Windows PowerShell
Let’s Begin!
PowerShell is a command-line interface (CLI)……that contains a rich, yet simplified scripting language for automating complex, multi-step tasksBuilt on the .NET FrameworkExtensible, so various products and technologies can be managed by “snapping in” tech-specific extensions
Most importantly… it’s discoverable! It can teach you how to use itself!
The Help System, Modules, and More
Letting PowerShell Teach You How to Use PowerShell
The Pipeline
PowerShell has an extremely powerful pipeline that works unlike anything that’s really been done beforeIt carries the output of one command to the input of the next… but it does so in an amazingly flexible wayIf you can master the pipeline (and the help system helps!)
ByValue. ByPropertyName, and ByJoveThatsAmazing
The PowerShell Pipeline
Speaking of CIM…
PowerShell remains the most effective way to access Windows Management Instrumentation, which provides a wealth of management informationV2 and v3 both have the “WMI” cmdlets, which utilize the old-school DCOM/RPC protocol for communicationsV3 Introduces “CIM” cmdlets, which use the same WMI back-end info repository, but communicate over WS-MAN
(And why WS-MAN is your new best friend)
WMI and CIM
And oh, You WANT WS-MAN!
First, it’s auto-enabled in Windows Server 2012It’s also the basis for PowerShell’s awesome-est feature, RemotingWe’ll do a quick Remoting demo, but Don has an entire “Remoting in Depth” session that you just gotta check out.
PowerShell Remotingand WS-MAN
Objects
You may have heard that PowerShell is an object-oriented shellPeople make a big deal of this because it enables a lot… but conceptually it’s pretty simpleEver see an Excel spreadsheet? It’s just a data structure, right? Well, that’s all objects are. Data structures, in memory. Every PowerShell command (well, most) produces objects… and PowerShell will even show you everything about them
It’s all just data!
Object-Oriented Shell
But You Know…
Not every technology lends itself well to a static set of predefined commandsTake IIS, or SQL Server, or anything else that’s extensible. How do you know what commands admins will need when you don’t even know everything that might be added into the product?The answer: Providers. PowerShell providers can make any storage – even configuration stores – look like a disk drive. You get to use familiar commands with them!
Adapting storage to look like a file system
PSProviders and PSDrives
Lots of Smarts
PowerShell includes a full set of comparison operators that, combined with a filtering cmdlet, let you remove things from the pipeline.It’s what’s left at the end of the pipeline that gets displayed.
Help about_comparison_operators is your friend!
Comparing and Filtering
Hate Syntax?
Yeah, it’s harder than clicking buttons in a GUI.And in large part you can still use a GUI if you want to, even though it may just be running PowerShell commands under the hood.
But think about where companies are headed… and think about your value to your organization.
Would You Rather be a Button Monkey…or a ToolMaker?
If you do something more than once… automate it.PowerShell finally gives us a way to do that.
Not a Button Monkey!
Become a ToolMaker
More Fun Tips
Why “cmdlet?”Formatting? Make it the last thing you do.Neat tricks with double quotes.Why you should avoid Write-Host
Formatting, Quotes, and How to Really Write
Last Quick Tips
Contact Info for Follow-Ups
Don:@concentrateddon on Twitterhttp://bit.ly/AskDon for online Q&ALearn Windows PowerShell in a Month of Lunches – get it anywhere or in the TechEd Bookstore!
Jeffrey:@jsnover on TwitterBlogs:
http://blogs.technet.com/b/windowsserver/ http://jsnover.com/blog
Related Content
WCL404: Building Reusable CLI and GUI Tools in PowerShell
WSV07-TLC: Windows Server 2012 Server Manager and PowerShell
DBI331: The Dirty Dozen: PowerShell Scripts for the Busy DBA
SIA404: Deep Dive on Windows Server Active Directory Shell
Find Me Later At “The Scripting Guys” pod in the Expo Hall!
SIA, WSV, and VIR Track Resources
Talk to our Experts at the TLC
#TE(sessioncode)
DOWNLOAD Windows Server 2012 Release Candidate
microsoft.com/windowsserverHands-On Labs
DOWNLOAD Windows Azure
Windowsazure.com/teched
Resources
Connect. Share. Discuss.
http://northamerica.msteched.com
Learning
Microsoft Certification & Training Resources
www.microsoft.com/learning
TechNet
Resources for IT Professionals
http://microsoft.com/technet
Resources for Developers
http://microsoft.com/msdn
Complete an evaluation on CommNet and enter to win!
MS Tag
Scan the Tagto evaluate thissession now onmyTechEd Mobile
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to
be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS
PRESENTATION.