Summary: A list of Windows
PowerShell sample scripts
The home page for the Channel9 Windows
PowerShell Wiki is
WindowsPowerShellWiki Also see the Windows
PowerShell page on
TechNet Script Center
* http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
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
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
PowerShell.