SVCC 5 introduction to powershell


Published on

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

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

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.
  • SVCC 5 introduction to powershell

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