Download presentation
Presentation is loading. Please wait.
Published bySusanna Patrick Modified over 9 years ago
1
Practical PowerShell Tips & Tricks MMS Minnesota 2014 Trevor Sullivan, Jeff Wouters, David O’Brien – Microsoft MVPs @pcgeek86 @jeffwouters @david_Obrien #MMSMinnesota #MMSConfigMgr #MMSLove
2
MMS Minnesota 2014 Speaker Profile – David O’Brien MVP for Enterprise Client Management Heavily focused on Automation Blog: http://www.david-obrien.nethttp://www.david-obrien.net Twitter: @david_obrien Principal Consultant at Dilignet in Melbourne
3
MMS Minnesota 2014 Speaker Profile – Trevor Sullivan Director of Training and Product Development @ Opsgility Likes trying new craft beers Passionate about spreading knowledge and awareness Microsoft MVP for Windows PowerShell http://trevorsullivan.net @pcgeek86
4
Speaker Profile – Jeff Wouters MVP Windows PowerShell | BSc | MBA MBA Psychology Lead Infrastructure DevOps Engineer @ Scripting, Automating, darts, beer. Blog: http://www.TheScriptingDutchman.com Twitter: @JeffWouters
5
Social Media MMS Minnesota 2014 #PSDSC #PowerShell
6
Agenda Prompt Function Splatting (v3) Where and ForEach Method Syntax (v4) Classes (v5) PSTypeNames.NET Formatting Variable Squeezing Type Casting Evaluations MMS Minnesota 2014
7
Splatting (v3) Easier to read code Separates input data from script logic Downside: No Intellisense for parameters HashTable (Parameters) HashTable (Parameters) Command Call
8
Where/ForEach Method Syntax Use a fluent-style syntax instead of PowerShell pipeline Filter (Where) Filter (Where) Objects ForEach
9
Classes (v5) Create custom object types Add properties and methods Decorate classes with existing attributes Lexical vs. dynamic scoping of variables Class Properties Methods Constructors Overloads Static Initializers Private class members are not supported Inheritance / interfaces not supported Namespaces
10
PSTypeNames Append custom type names to existing objects Apply a custom type to a PSCustomObject Use the [PSTypeName()] parameter attribute to constrain input objects Object PSTypeNames PSTypeName
11
.NET Formatting Value substitution Date formatting Numeric formatting Custom formatters Format String Objects
12
Variable Squeezing Simplified syntax to assign variables and print output
13
Type Casting Convert objects from one type to another Explicitly declare variable types Some types support “Parse” method instead Int32 Int64
14
PowerShell ISE Tips New PowerShell Tabs (Runspaces) Invoke Intellisense Snippets Console vs. Script Pane Horizontal/vertical split vs. script-only view ISESteroids MMS Minnesota 2014
15
Session Title Evaluations Please provide session feedback by clicking the Eval button in the scheduler app. One lucky winner will get a free ticket to the next MMS! Visit all of our sponsors in the expo area and online! Platinum Sponsors: Gold Sponsors : MMS Minnesota 2014
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.