Mr. Roboto

Windows 7 Resource Kit PowerShell Pack: Pack Some Power in Your Shell

If you've been using Windows PowerShell for a while, hopefully you've discovered how much it can help in day-to-day administration, as well as how easy it is to use. However, you might not be up to writing your own scripts and functions just yet. Well, now you can pack a real wallop into PowerShell with the Windows 7 Resource Kit PowerShell Pack from Microsoft.

You can download the PowerShell Pack from code.msdn.microsoft.com/PowerShellPack to your Windows 7 desktop (it requires PowerShell 2.0). Once it's downloaded and installed, you can access more than 650 scripts and functions divided into a number of PowerShell modules. (For a list of these modules, see "Windows 7 Resource Kit PowerShell Pack Modules.")

Windows 7 Resource Kit PowerShell Pack Modules
Module Description
WPK Create rich UIs quickly and easily from Windows PowerShell
TaskScheduler List, create or delete scheduled tasks
FileSystem Monitor files and folders, check for duplicate files and disk space
IsePack Shortcuts and add-ons to the PowerShell Integrated Scripting Environment
DotNet Explore loaded types, find commands that can work with a type, and discover how to work with .NET and COM objects in PowerShell
PSImageTools Convert, rotate, scale, and crop images and get image metadata
PSRSS Scripts and functions for working with the FeedStore provider
PSSystemTools Get OS and hardware information
PSUserTools Get the users on a system, check for elevation, and start a process as an administrator
PSCodeGen Generate PowerShell scripts, C# code and P/Invoke

To use any of the modules, you first need to import it:

PS C:\> import-module FileSystem

To see what you can do with the module, ask Get-Command:

PS C:\> get-command -module 
FileSystem

You should get a list of nine functions. All the functions include help and examples just like cmdlets.

The PSSystemTools module has some useful scripts for returning OS information as well as testing for 32 or 64 bit. I wish some of these functions supported remote computers, but if you push out these modules to your remote computers you could run these tools in a remote session.

In PSUserTools -- my favorite tool -- is the Start-ProcessAsAdministrator function. This function works very much like Start-Process, although it launches the designated process in an elevated session as an administrator. This means you can run your scripts as a normal, non-elevated user and when necessary use this command to execute as an administrator.

The TaskScheduler module contains some useful commands for managing scheduled tasks locally and on remote computers. In the past, I've always recommended using Schtasks.exe if you needed command-line control. But now there's a PowerShell alternative:

PS C:\> New-Task | Add-TaskTrig 
ger -onlogon | Add-TaskAction 
-script {c:\scripts\posh\logon 
task.ps1} | Register-Sched 
uledTask "My Logon Task"

There are several steps, but you can combine them in a pipelined expression. The first step is to create the task object, which is then piped to Add-TaskTrigger. This is where I specify when to run the script or what triggers it. In my example, the task runs at user log on. The object is then piped to Add-TaskAction, which is where I define a task: running a PowerShell script. Finally the task is registered.

The PowerShell Pack offers a lot of functionality that I believe you can begin using immediately. I encourage you to test these tools in a non-production environment.

About the Author

Jeffery Hicks is a multi-year Microsoft MVP in Windows PowerShell, Microsoft Certified Professional and an IT veteran with almost 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He works today as an independent author, trainer and consultant. Jeff is a regular contributor to a variety on online sites, as well as frequent speaker at technology conferences and user groups. Keep up with Jeff and his projects at http://jdhitsolutions.com/blog.

comments powered by Disqus

Redmond Tech Watch

Sign up for our newsletter.

I agree to this site's Privacy Policy.