Sample PowerShell Scripts

PowerShell Many of you attended my TechNet events have asked me about getting the sample scripts I used in the PowerShell session. Kevin Remde, one of our best presenters in the TechNet Team, has contributed and shared pertinent information including event resources pages and our PowerShell demo scripts. I have now made them available as a download. Here's how you can try them:

  1. Install PowerShell
  2. Download the attachment of this blog and extract the scripts.
  3. Copy and paste any of the non-commented lines (i.e. any line without a "#" in front of it) into your PowerShell command prompt.
  4. Examine the results.

Use get-command to list out all the cmdlets, get-help with -full switch to get the examples in the help file. And get-member to review all the methods and attributes of an object.

Please notice these sample scripts include cmdlets may change the state of a Windows computer including stopping necessary services, so run them at your own risk. To mitigate the risk, use the –whatif to examine the effect and -confirm for getting prompted before the execution of a cmdlet. Neither Yung Chou, nor Microsoft assumes any responsibility for damage caused by using them in any computing environment, including on a production machine.

Check out my TechNet Event Resource page with a list of resources relevant to the PowerShell session. Additionally, for Getting Started Guide and Quick Reference, get the Windows PowerShell 1.0 Documentation Pack. To use PowerShell for IIS administration, install IIS 7.0 PowerShell Provider. Also readily available for download are Sample Windows PowerShell scripts in Script Center Script Repository and free books of PowerShell workshops by Frank Koch in Microsoft Switzerland.

PowerShellDemoFiles.zip