Windows PowerShell - Billings .NET User Group - August 2009

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Notes on slide 1

    Shells have historically executed commands or utilities and presented results as textCmd.exe is the shell on windowsFew built-in commands, large variety of external utilities

    You can filter by verb

    You can filter by noun

    Applications found in your path are available in PowerShellOutput from executables becomes a full-fledged object in PowerShell

    Anything can be navigable using PowerShell providers!Even the registry!

    SQLPS.exe, which comes with SQL Server 2008, is a custom PowerShell hostIt adds its own provider for navigating objects in SQL Server instances

    The things returned by providers are itemsYou can use the –Item commands to work with them directlyIn this case when we get the subtext item we see that it is a Database type from the SMO library

    Like everything else there are simple commands for filtering, looping, and sortingThose commands have simple aliasesFilter using whereSelect a new object from an existing object using selectLoop using foreach – notice that your have to ‘return’ something at the endTypical comparison operators like =, <, > aren’t used for parsing reasons

    Creating a virtual machine using Hyper-V

    Twitter!

    It may be easier to believe now, but there is a lot you can do with PowerShell without even opening Visual Studio.

    Favorites, Groups & Events

    Windows PowerShell - Billings .NET User Group - August 2009 - Presentation Transcript

    1. Windows PowerShell
      John Clayton
      http://codemonkeylabs.com/
    2. Next generation command line shell
      Processes objects instead of plain text
      Large set of built-in commands
      Consistent command parser
      Scripting language
      Designed for managing .NET objects
      Provides a consistent environment for using cmdlets
      Supports complex tasks without making simple tasks more complex
      What is it?
    3. Built on .NET
      Underlying objects are .NET
      Extensible via cmdlets, providers, & host applications
      Targeted at IT professionals
      Supported by the latest server products
      An astonishing amount can be accomplished without any programming
      TechNet Script Center has hundreds of resources
      What is it? (cont.)
    4. Using Windows PowerShell
      Prepare to be amazed
    5. All commands use a Verb-Noun syntax
      Self-describing, discoverable environment
      Tab expansion
      Command aliases
      Brings in native applications & utilities
      Object pipeline
      Formatting
      Navigation
      Filtering
      Scripting
      The Shell
    6. Get-Command
    7. Get-Command
    8. Get-Command
    9. Get-Help
    10. Get-PSDrive
    11. Get-Member
    12. Command Aliases
    13. Native Applications
    14. Object pipeline
    15. Formatting
    16. Navigation
    17. Navigation
    18. Navigation
    19. Filtering, Looping, & Selecting
    20. Scripting
    21. Scripting
    22. Scripting
    23. Scripting
    24. Extending Windows PowerShell
      If built in it is not, make it you shall
    25. Creating Cmdlets
      In a class library reference System.Management.Automation
      Hint: It’s not in the GAC!
    26. Creating Cmdlets
      In a class library reference System.Configuration.Install
    27. Creating Cmdlets
      Add a class and build your cmdlet
    28. Creating Cmdlets
      Add a class and build your snap-in
    29. Creating Cmdlets
      From an administrative Visual Studio command prompt navigate to your output directory and install your assembly
      Gotcha: On a 64-bit system you’ll need to use the 64-bit version of InstallUtil.exe
    30. Creating Cmdlets
      Launch a new instance of PowerShell
      View the registered snap-ins:
      Get-PSSnapIn –Registered
      Register the snap-in:
      Add-PSSnapIn
    31. Creating Cmdlets
      Export the current console:
      Export-Console
      Include the exported file in your project
      Set it to always copy to the output directory
    32. Creating Cmdlets
      In the project properties set the debug action to start powershell.exe
      In the command line arguments specify your console export file using the –PSConsoleFileflag
    33. Creating Cmdlets
    34. Hosting PowerShell
      Create a new windows forms application
      Add a reference to System.Management.Automation and your snap-in project
    35. Hosting PowerShell
      In the form use a RunspaceConfiguration instance to add your snap-in, then create and open the runspace
    36. Hosting PowerShell
      Using the runspace create and invoke a pipeline
      Remember that Get-Proc is returning a collection and not individual items!
    37. PowerShell 1.0
      Included in Windows Server 2008
      Separate download for Windows XP SP2, Windows Server 2003, & Windows Vista
      PowerShell 2.0
      Included in Windows 7 & Windows Server 2008 R2
      RC available for Windows XP SP3, Windows Server 2003 SP2, Vista SP1, & Windows Server 2008
      Where do I get it?
    38. http://blogs.msdn.com/PowerShell/
      http://bit.ly/powershell-ebook
      http://bit.ly/scriptcenter
      http://bit.ly/poshtweet
      http://bit.ly/easy-powershell
      Resources
    SlideShare Zeitgeist 2009

    + John ClaytonJohn Clayton Nominate

    custom

    217 views, 0 favs, 1 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 217
      • 213 on SlideShare
      • 4 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 4
    Most viewed embeds
    • 4 views on http://codemonkeylabs.com

    more

    All embeds
    • 4 views on http://codemonkeylabs.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories