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...
powertips
Categories
- Free tools
- SQL Admin Toolset
- SQL Compliance Manager
- SQL Defrag Manager
- SQL Diagnostic Manager for MySQL
- SQL Diagnostic Manager for SQL Server
- SQL Diagnostic Manager Pro
- SQL Doctor
- SQL Enterprise Job Manager
- SQL Inventory Manager
- SQL Query Tuner for SQL Server
- SQL Safe Backup
- SQL Secure
- SQL Workload Analysis for SQL Server
- Uptime Infrastructure Monitor Formerly Uptime
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...
Finding Script Errors
There is scripting expertise built-in to PowerShell v.2 that can be activated like this: set-strictmode -version 1set-strictmode -version 2 Use the...
Getting System Uptime
If you'd like to determine a system's uptime, you should use WMI and convert the WMI date into a more readable format: function...
Display Work Hours in Prompt
Up for some fun with your prompt? Make it a bit shorter, display the minutes (or hours) you have been working so far, and show the current path in...
Count Your Work: Calculating Process Runtime
Each process stores its start time, so it is fairly easy to find out when the process was launched. If you'd like to know when you started your...
Accessing Current PowerShell Process
If you ever want to access the process that is executing your current PowerShell session, use the $pid automatic variable which tells you the...
Adding Custom Methods to Types
In a previous tip, we have added a new script method to a string called Words() which would split the string into words. But is it worth the effort?...
Adding Custom Methods to Objects
In a previous tip, you learned how to add custom properties to objects. Today, we want to show you how to add custom methods and also give an...
Adding Custom Properties
You may have heard that PowerShell can add custom properties to objects. While we are not going into much detail about this here, we'd like to...
CSV-Files With Culture
In a previous tip, you learned that CSV files use different separators, depending on your culture. While you were unable to select a separator in...
CSVs with Alternative Delimiters
In PowerShell V1, creating CSVs wasn't very flexible because PowerShell was limited to the comma as separator. In many cultures, different...
Persisting Objects with XML
In the previous tip, you learned that Export/Import-CSV does not persist property types. Instead, all properties are converted to string. To...
Import-CSV and Types
Export-CSV and Import-CSV are great ways of persisting data in a structured way. There are some limitations, though. Take a look. This line saves a...
PowerShell ISE uses Unicode
If you start experimenting with PowerShell V2 ISE (editor), you may notice that all scripts you create are saved in Unicode by default. This was...
Finding Alias Names in V2
Alias names are shortcuts for other commands, and you probably know that. In PowerShell V1, the only way to retrieve all aliases for a given target...
Storing Cmd-Results in PowerShell Variables
You can run classic cmd commands from within PowerShell and store the results in variables. All you need to do is invoke cmd.exe with the /c switch...
Using Classic Shell Inside of PowerShell
Since both PowerShell and the classic cmd.exe are console-based, it is very easy to switch between both of them. If you must use a classic shell...
Deleting Characters in the Console
Moving the cursor in long input lines is not very convenient. You cannot use the mouse and have to use arrow keys to move backwards and forward....