Windows 7 Resource Kit PowerShell Pack: Pack Some Power in Your Shell
- By Jeffery Hicks
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
||Create rich UIs quickly and easily from Windows PowerShell
||List, create or delete scheduled tasks
||Monitor files and folders, check for duplicate files and disk space
||Shortcuts and add-ons to the PowerShell Integrated Scripting Environment
||Explore loaded types, find commands that can work with a type, and discover how to work with .NET and COM objects in PowerShell
||Convert, rotate, scale, and crop images and get image metadata
||Scripts and functions for working with the FeedStore provider
||Get OS and hardware information
||Get the users on a system, check for elevation, and start a process as an administrator
||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
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
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.
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.