Channel9 Wiki

Wikis are cool because they're up to you.

Recent Changes
Lost and Found
Find References
Highlight Changes

Versions

Versions:

Windows Power Shell Sample Scripts

Summary: A list of Windows PowerShell sample scripts

The home page for the Channel9 Windows

5/18/2006 1:53:12 PM - 00011147BCAA96A8
PowerShell Wiki is WindowsPowerShellWiki

Also see the Windows

5/18/2006 1:53:12 PM - 00011147BCAA96A8
PowerShell page on TechNet Script Center

ArchiveIISLogFiles

A script that will archive IIS Log files for you.

ArchiveIISLogFilesToZipVia7Zip

A modified version of the original script, using 7-zip to create zip files

DaysTill

This script tells you the number of days until a specic day (such as a birthday, or holiday).

Example:

 PS>daystill 12/25/2004
 66

FindStringsInWordDocuments.msh

Trim-SparseText

Windows

5/18/2006 1:53:12 PM - 00011147BCAA96A8
PowerShell composition capabilities make some tasks that normally would take several lines of code in a scripting language into one-liners. Trim-SparseText is a good example; it's a simple filter that cleans up incoming input strings for easier parsing later. It removes all leading or trailing whitespace, and then only emits the text if it is longer than 0 length.

  filter Trim-SparseText{$_ = $_.Trim();if($_){$_;} }

PSColorFunctions

This contains two functions which you can use to control the color of text written to the console, as well as an example custom prompt that makes use of them.

ReadRSS

A script that takes a URL and maximum number of results and returns the titles of a given RSS 2.0 feed.

SqlConnect

This is an example script that instantiates, opens, and closes a SqlConnection object within Windows

5/18/2006 1:53:12 PM - 00011147BCAA96A8
PowerShell.