SVCC 5 introduction to powershell

  • 844 views
Uploaded on

Session Given Oct 9th 2010 @ Silicon Valley Code Camp.

Session Given Oct 9th 2010 @ Silicon Valley Code Camp.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
844
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
35
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • This template can be used as a starter file for presenting training materials in a group setting.SectionsRight-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors.NotesUse the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production)Coordinated colors Pay particular attention to the graphs, charts, and text boxes.Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale.Graphics, tables, and graphsKeep it simple: If possible, use consistent, non-distracting styles and colors.Label all graphs and tables.

Transcript

  • 1. Introduction To Powershell
    Paul H Cassidy
    Test Automation Lead
    Front Porch – Sonora, CA
    http://www.twitter.com/qa_warrior
  • 2. Agenda
    Introduce PowerShell
    Learn to investigate and explore PowerShell
    Demo’s showing a bit of what is possible with PowerShell
  • 3. Windows PowerShell
    A command line and scripting language
    As interactive and engaging as BASH/KSH
    As programmatic as Perl/Python/Ruby
  • 4. State of the Software - Community
    • Active and useful Newsgroups and Forums
    • 5. Lots of active Codeplex projects
    • 6. Strong group of MVPs
    • 7. Strong community tools
    • 8. Lots of books covering specific and general areas
  • The Difference is OBJECTS!
    Get-Process | Where { $_.handles –gt 500 } | Sort handles | Format-Table
    Common Windows PowerShell Parser
    Get-ProcessCmdlet
    Sort Cmdlet
    FormatCmdlet
    Where Cmdlet
    Windows PowerShell Pipeline Processor
  • 9. Productivity
  • 10. Learn and Leverage
    In the box documents
    Release Notes
    Getting Started, User’s Guide, Quick Reference
    Help
    Discovery utilities
    Books
    Community
    Practice ad hoc development
  • 11. Utilities - Discovery
  • 12. Discovery Utilities
    Windows PowerShell
    demo
  • 13. Utilities – Object Manipulation
  • 14. Object Manipulations Utilities
    Windows PowerShell
    demo
  • 15. Transformation and Output
  • 16. Transformation and Output Utilities
    Windows PowerShell
    demo
  • 17. PowerShell provides native access to any .NET class
    Create any object
    [reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
    $d = New-Object System.DateTime 2006,12,25
    Access Properties/Invoke Methods
    $d.DayOfWeek
    $d.AddDays(-30)
    Access Statics
    [DateTime]::Now
    [DateTime]::IsLeapYear(2008)
    Scripting with .NET
    Allows admins to easily access and leverage a huge API set because of scriptability, utilities and formatting
  • 18. .Net Scripting
    Windows PowerShell
    demo
  • 19. Access existing instrumentation
    Bind to COM objects
    $fso = New-Object -ComObjectScripting.FileSystemObject
    $m = [System.Runtime.InteropServices.Marshal]
    $word = $m::GetActiveObject("Word.Application")
    Invoke methods/access properties
    $fso.GetDrive(“C:”)
    $fso.VolumeName = “System Drive”
    Manipulate and format results
    Define and import custom formating
    Update-FormatData Office.Word.Format.ps1xml
    $word.RecentFiles | Sort name | Format-Table
    Scripting with COM
    Allows more simpler/more powerful COM scripts because of utilities and formatting
  • 20. PowerShell provides native WMI support
    Get-WmiObject
    Allows for inspection of WMI namespace
    Get-WmiObject –list [-Namespace xx]
    Get-WmiObject –Class xx –Namespace xx –Property xxx – Filter xxx –ComputerName xxx –Credential xxx
    Native language support
    [WMI] “PSDESK10 ootcimv2:Win32_Process.Handle="0“
    [WMICLASS] "ROOTcimv2:WIN32_PROCESS"
    [WMISEARCHER]"select * from Win32_process WHERE Name = 'calc.exe'"
    Scripting with WMI
  • 21. WMI Scripting
    Windows PowerShell
    demo
  • 22. PowerShell provides native XML support
    [XML]”<root>…. </root>”
    Projects a “data-view” of XML
    Scripting with XML
  • 23. XML Scripting
    Windows PowerShell
    demo
  • 24. Community Resources
    Newsgroup: Microsoft.Public.Windows.PowerShell
    Team blog: http://blogs.msdn.com/PowerShell/
    PowerShell Community: http://www.PowershellCommunity.Org
    Community Script Repo http://www.poshcode.org
    Channel 9 http://channel9.msdn.com/tags/PowerShell
    Wiki
    http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki
    Script Center: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
    CodePlex:
    http://codeplex.com/Project/ProjectDirectory.aspx?TagName=powershell
    Many excellent books
    Manning Press book by PowerShell Dev Lead Bruce Payette: PowerShell in Action http://manning.com/powershell/
    O’Reilly book by PowerShell Dev Lee Holmes – Windows PowerShell Cookbook
    http://www.oreilly.com/catalog/9780596528492/index.html
    Session Demos for Introduction To Powershell
  • 25. Q&A