Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PowerShell crash course

971 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

PowerShell crash course

  1. 1. 75-Minute PowerShellCrash Course<br />Don Jones<br />Concentrated Technology<br />http://ConcentratedTech.com<br />
  2. 2. 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.<br />For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site, www.ConcentratedTech.com. <br />For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg<br />This work is copyright ©Concentrated Technology, LLC<br />
  3. 3. Welcome!<br />This is a demo-intensivesession<br />I will capture a shell transcript, which will be downloadable from ConcentratedTech.com next week<br />We will be covering key PowerShell usage patterns, using real-world tasks as our examples<br />Learn these patterns and you can teach yourself to do anything you need to in PowerShell!<br />
  4. 4. Loading Extensions, Learning Commands<br />Snap-ins<br />Get-PSSnapin –registered<br />Add-PSSnapinname<br />Get-Command –pssnapinname<br />Modules<br />Get-Module –listAvailable<br />Import-Module name<br />Get-Command –module name<br />Help<br />
  5. 5. Cmdlet and Parameter Names<br />Verb-Noun (singular)<br />-parameter value<br />“quotes” or ‘quotes’ around strings (especially those with spaces)<br />Use wildcards with Help<br />Use –full, -example, and –online with Help<br />Use Get-Command<br />
  6. 6. Piping<br />Like Dir | More only better<br />Pipeline binding ByValue<br />Pipeline binding ByPropertyName<br />
  7. 7. Tables of Information<br />Use Get-Member to see all “columns”<br />Okay, these are really objects<br />Column = Property<br />Row = Object (instance)<br />Use Format-List, Format-Wide, and Format-Table<br />Wildcards work with –property param<br />
  8. 8. Manipulating Objects<br />Sorting<br />Measuring<br />Selecting subsets<br />Selecting specific properties (columns)<br />
  9. 9. Custom Property Syntax<br />Works with –property parameter of Select-Object, Format-List, and Format-Table<br />@{n=’col_name’;e={$_.expression}}<br />Use this to bind ComputerNameByPropertyname<br />
  10. 10. Two More Ways of GettingComputer Names<br />(parentheses) with Select-Object –expand<br />(parentheses) with Get-Content<br />
  11. 11. Comparison Operators<br />-eq, -ne<br />-ge, -gt<br />-le, -lt<br />-list (use * as wildcard)<br />All case-sensitive<br />Use –ceq, -cne, etc. for case-sensitive<br />
  12. 12. Filtering Objects<br />Use Where-Object –filterscript {}<br />$_ represents the current row (object) that was piped in<br />
  13. 13. WMI<br />Use Get-WmiObject<br />Specify –class and –namespace (unless it’s rootCIMv2)<br />Specify –filter (WQL syntax, not PowerShell)<br />Pipe to Sort, Select, Where, etc.<br />Drive inventory anyone?<br />Use WMI Explorer to locate stuff<br />
  14. 14. Making Things Happen<br />Batch Cmdlets<br />Invoke-WmiMethod<br />ForEach-Object ($_ again!)<br />
  15. 15. Scripting<br />Security (Get/Set-ExecutionPolicy)<br />.PS1 filename extension<br />Parameterizing a script<br />Script  Function<br />Dot-sourcing functions<br />Creating “script modules”<br />
  16. 16. That was a lot.<br />There’s a ton more…<br />Learn it all in an hour a day with Learn Windows PowerShell in a Month of Lunches<br />Companion DVD includes 99 demo videos that align with each chapter<br />
  17. 17. Final Q&A<br />Text DONJ to 50500 for contact info<br />See me for add’l resources<br />Books<br />Workshop recordings<br />Demo videos<br />Etc<br />Slide decks posted to ConcentratedTech.com by next week<br />
  18. 18. Your Feedback is Important<br />Please fill out a session evaluation form drop it off at the conference registration desk.<br />Thank you!<br />
  19. 19. 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.<br />For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site, www.ConcentratedTech.com. <br />For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg<br />This work is copyright ©Concentrated Technology, LLC<br />

×