You may have come across the –f operator before and wondered what it does. It’s the format operator and provides an extremely easy way...
database-tools
Creating Backup Copies of Many Files
PowerShell can quickly create backup files of your files. All you need to adjust is the type of files you want to backup, and the file extension you...
Piping Results Straight Into Office Word
With only a few lines of code you can implement a command called Out-OfficeWord. It takes the data you pipe into it and inserts them into a new Word...
Search WMI for Useful Information
WMI is a great source of information but it is not always easy to find out the names of valid WMI classes to query. Here is a little search tool: it...
Use a Grid View Window as a Universal Dialog
Out-GridView can be much more than just a window showing results. You can turn it into a pretty useful universal dialog. Let's assume you want...
Outputting File Sizes in Different Formats
When you store a number in a variable, you may want to display the number in different units. Bytes are very precise, but sometimes displaying the...
Converting Date/Time Formats
Here is a simple PowerShell filter that can convert any DateTime object into any date/time-format you like: #requires -Version 1 filter...
Waiting for Process Launch
PowerShell has a built-in support to wait until a process or many processes end: simply use Wait-Process. There is no support to do the opposite:...
Invoking Different Code Based on Parameter Value
Here is a simple concept using an action parameter with a number of choices. Each choice refers to a script block that would be executed then....
Finding Script Block Variables
Script blocks define a PowerShell code without executing it. The easiest way of defining script blocks is placing code into braces. Script blocks...
Getting Installed Software Remotely
In a previous tip we introduced the Get-Software function that was able to retrieve installed software from local computers. If you have enabled...
Reading Installed Software from Registry
Here is a very quick way of finding installed software. The Get-Software function reads both the 32- and 64-bit locations for software installed for...
Display Message Box Dialog
PowerShell is console-based, but sometimes it would be nice to add some simple dialogs. Here is a function called Show-MessageBox that can display...
Use Server-Side Filtering When Possible
When you retrieve information across a network, always make sure you use client-side techniques like Where-Object as a last resort. Server-side...
Turning Lists of Numbers Into Useful Lists
PowerShell features the ".." operator which produces lists of numbers. With the -join operator, you can convert these to almost anything...
ER/Studio Model Repository Database Sizing Guide for IBM DB2
Howdy! In this final installment, I will be covering on how to ensure optimum model repository performance for IBM DB2. [Update Statistics]...
Checking for AC Power
Ask WMI to find out whether your notebook is connected to AC: #requires -Version 1 $battery = Get-WmiObject -Class Win32_Battery | Select-Object...
Creating Enumerations
PowerShell 5.0 added the capabilities to define enumerations but in older PowerShell versions, you can create enumerations too, simply by compiling...
Crazy Prompt Function
The built-in "prompt" function is invoked whenever PowerShell completed interactive input, and you can use it to change the way your...
Conversation with PowerShell
Today's tip is using the programmable CommandNotFoundHandler to have PowerShell talk with you once you enter an unknown command:...
Finding Operating System Version
One of the easiest ways of getting your operating system version is this one line of code: PS> [Environment]::OSVersion Platform ServicePack...
Why Some Errors Aren't Caught
When you receive a red error message from PowerShell, you can always encapsulate the code in a try…catch block and handle the error yourself:...
Using Paths in Prompts
The default PowerShell prompt displays the current location. When you are deep inside nested folders, this steals room for your actual input, and...
Help Make PowerShell a Better Place!
Rather than ranting about things that don't work as expected, or things you feel are missing, be constructive! The PowerShell team takes great...