Share via


PowerShell Saturday 007 Charlotte: From Cmdlets to Scripts to PowerShell Hero

PowerShell Saturday 007

 Today I am spending time with passionate PowerShell people in Charlotte.  This is a blast!  Greetings to:

  • Ed Wilson @ScriptingGuys
  • Theresa Wilson @ScriptingWife
  • Glenn Sizemore @GlnSize
  • Jim Christopher @Beefarino
  • Brian Wilhite @BWilhite1979
  • And many more…

For those in my sessions... nice to meet y’all!

Session Description

Tired of copying and pasting scripts from the internet?  Want to write youwn scripts?  Become the go-to scripter on your team.  This session will break down the scripting process into logical steps you can follow.  Learn how to wrap cmdlets into scripts into functions into modules that you can reuse and share with your team.

Give a man a script; feed him for a Get-Date. Teach a man to script; feed him for a New-TimeSpan.

Lao Tzu, 4th century BC

The Goal

My goal in this session is to help people move from “copy and paste” scripters to “I can do this” scripters.  I want to demystify the scripting process for beginners.  It would be easy to spend a whole day covering this topic, so this session is a good intro to the creative process of beginning a script.  We focus mostly on the overview and the cmdlets discovery process in part one.  In part two we focus more on functions and modules.

The demo scripts for this session will walk you through the PowerShell scripting process from start to finish. Download the demo scripts and slides attached at the bottom of this blog post.

The PowerShell Scripting Process

In this session we walk through each step of creating a PowerShell solution:

  • Idea – What do I need to script today?
  • Cmdlets – Which cmdlets, parameters, properties, and methods do I need?
  • Pipeline – Can I do this in one line?
  • Script – Move it from the console to the ISE.  Use it again later.
  • Function – Call that code over and over and over and over and over.
  • Module – Share it with others.
  • HERO! – You are now the PowerShell hero on your team.

The Development Cycles

After years of scripting I put together an outline of the development cycle.  I know others have written books about this topic, but I’ve not read any of them.  These are my observations based on years of experience.

  • Phase 1 – Core functionality
    • Write
    • Test
    • Debug
  • Phase 2 – Make it friendly
    • Documentation/Comments/Help
    • Error handling
    • Logging
  • Phase 3 – Release
    • Publish
    • Update
    • Version control
    • Support

Watch Both Full Sessions

Part 1

Part 2

Resources

Microsoft Virtual Academy free beginner PowerShell training:

Books by Ed Wilson:

PowerShellSaturday007-Scripting_Essentials-GoateePFE.zip

Comments

  • Anonymous
    February 16, 2014
    227 Microsoft Team blogs searched, 65 blogs have new articles. 154 new articles found searching from