database-tools

Examine "Extended" Object Members

PowerShell is based on .NET objects but often refines them by adding more. If you'd like to see just what PowerShell has added, use Get-Member...

Writing Back WMI Property Changes

Only a few properties in WMI objects are actually writeable although Get-Member insists they are all "Get/Set": PS> Get-WmiObject...

Creating Dynamic Breakpoints

The PowerShell 3.0 ISE editor has a simple debugger built-in that supports line breakpoints. Simply press F9 to set a breakpoint (which only works...

Creating "Mini-Modules"

Did you know that every PowerShell function can be turned into a script module with just one line of code? To test drive this, open the ISE editor...

Ripping All Links from a Website

PowerShell 3.0 comes with a great new cmdlet: Invoke-WebRequest! You can use it for a zillion things, but it can also simply retrieve the content of...

Splitting Hexadecimal Pairs

If you'd have to process a long list of encoded information, let's say a list of hexadecimal values, how would you split the list into pairs...

Cutting Off Text at the End

Cutting off a part of a text at its beginning is easy. This line eats the first 3 characters: PS> 'C:\folder\file.txt'.SubString(3)...

Use -f with N0

Often, it is necessary to output numbers, but you may want to control the number of digits and would like to control the formatting. The -f operator...

Sending Results to Excel

Here's a little function called Out-ExcelReport. Just pipe anything to it, and it will open in Microsoft Excel - provided it is installed on...

Unix Log Scanner

After the installation of the Unix Log Scanner using the uptime plugin manager I try to create a service monitor. But every time I run the test I...

Executing Elevated PowerShell Code

Sometimes, a script may want to execute some portion of its code elevated, for example to write to HKLM in the Registry or change protected...

Examine Parameter Binding

PowerShell caters all tastes which is why the next two lines do the exact same thing and get all JPG pictures from your Windows folder: PS>...

Multiline-Input in ISE Editor

If you'd like to enter long lines of code into the console panel in the new PowerShell 3.0 ISE, you can press SHIFT+ENTER. This will add a line...

Kindergarten-Mode

To protect you from damages while playing with PowerShell on a productive system, set the ”WhatIf” mode as default:...

Combining Objects

Sometimes it becomes necessary to consolidate two or more objects into one. So, how would you combine object properties into one object? In a...

Finding Newest or Oldest Files

In PowerShell 3.0, Measure-Object can be applied not just to numeric data but to anything that is comparable. In PowerShell 2.0, this line would...

NULL values have a Count property

In a previous tip we explained that in PowerShell 3.0, every object has a Count property now. This even includes null values: PS> $null.Count 0...

"Count" Available in PowerShell 3.0

Finally, the property Count is available on all objects in PowerShell 3.0. This solves a great problem because it allows you to count results even...

Removing Empty Object Properties

Objects hold a lot of information and often, properties can also have null values. To reduce an object to only those properties that actually have a...