PowerShell crash course

download PowerShell crash course

of 19

  • date post

    05-Dec-2014
  • Category

    Technology

  • view

    1.140
  • download

    3

Embed Size (px)

description

 

Transcript of PowerShell crash course

  • 1. 75-Minute PowerShellCrash Course
    Don Jones
    Concentrated Technology
    http://ConcentratedTech.com

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