In PowerShell v.2, you can import modules to load additional cmdlets and providers. Windows 7 comes with a number of such modules. Use the...
database-tools
Getting Image Details
PowerShell can access COM-Objects as there are many useful objects present on a system. For example, WIA.Image can return all kinds of useful...
Picking Random Items
In PowerShell V2, Get-Random retrieves as many random numbers as you like, allowing you to use this random number generator in many scenarios. A...
Breaking Compatibility With PowerShell V1
When you move onto PowerShell V2, most of your V1 scripts will hopefully continue to work. There are only few bug fixes that could affect...
Restarting Processes
You may want to occasionally restart a single-instance process. However, shutting down a process does not necessarily mean it is killed in that...
Finding Unwanted Output
PowerShell has an extremely flexible way of submitting return values. Instead of explicitly setting the return value of a function, PowerShell...
Deleting Event Logs
Working with event logs has become a lot easier in PowerShell v.2, and you have seen how you create and maintain your own logs. So, if you'd...
Creating Your Own Eventlog
In PowerShell v.2, it is very easy to create and maintain your very own event logs to track errors in your scripts or other automation solutions....
Finding Events Supported by an Event Provider
In PowerShell v.2, Get-WinEvent provides access to events written to the numerous Windows event logs. In addition, you can also examine event...
Organizing Windows Event Logs By Source
There are numerous Windows event logs and you now have full control using Get-WinEvent in PowerShell v.2. Instead of searching for specific event...
Handling Event Logs with Get-WinEvent
In PowerShell v.1, Get-Eventlog would retrieve standard event log entries from event logs like "System" or "Application," but...
Getting Process Based On Window Title
It isn't always easy to pick the right process because the process ID or process name may not be known or ambiguous. If the process has a window...
Getting Process Windows Titles
Get-Process retrieves all running processes and a wealth of information attached to them. One especially useful property is mainWindowTitle which...
Loading New Windows 7 Modules
Windows 7 comes with a bunch of modules that are not loaded by default. Use this to see which modules are available: Get-Module -listAvailable For...
Accessing Hidden Module Members
Modules in PowerShell v.2 can declare which functions, variables, aliases etc. are public and visible to the caller and which ones are hidden. With...
Managing PowerShell Modules
In PowerShell v.2, all new modules work like libraries and can be loaded using Import-Module to gain access to all public functions, variables,...
Updating PowerShell Modules
In a previous tip, you learned about the new modules in PowerShell v.2, which can be loaded using Import-Module. Once you have loaded a module, it...
Creating Script Modules
In PowerShell v.2, there is a new feature called "module," which is a file with the extension .psm1 and behaves almost exactly like a...
Trap and Try/Catch
Trap, which has been around since PowerShell v.1, is designed to catch errors and works like this: trap { Write-Host -foregroundcolor Yellow `...
Which PowerShell Version Am I Running
As PowerShell v.2 becomes more common , you may want to check which PowerShell version a machine is running. Use this to differentiate between v.1...
Is PowerShell Available?
As PowerShell becomes more important, you may want to automatically check whether it is available on a machine. To determine whether any PowerShell...
Checking Whether Hash Table Contains Key
In the previous tip, you used a hash table to translate input values. However, unlike Switch-statements, Hash Tables have no "default" so...
Using Hash Tables Instead of Switch
You may have already used Switch to translate input and output values like this: function Get-Name($number) { switch ($number) { 1 { "One"...
Processing Switch Return Value
You probably know that the Switch statement checks against a value and returns whatever you have defined for this condition like so: function...