database-tools

Automatic Aliases

All Get-Cmdlets (cmdlets that start with "Get") have an automatic type accelerator. You can use those cmdlets without the verb. So...

read more

Exploring Privileges

On Vista with UAC enabled, you are not Admin by default. It might be interesting to find out if PowerShell currently has Admin privileges enabled....

read more

Enumerating Drive Letters

Sometimes, you may want to find the next available drive letter for a network drive or enumerate drive letters for other purposes. An easy way to...

read more

Counting Items in a Folder

Get-Childitem returns all files in a folder. PowerShell returns an array if there are at least two items in a folder. To force PowerShell to always...

read more

Converting Numbers

The .NET convert class is a great help when you need to convert numbers between different systems. Here's how you can convert a decimal into a...

read more

Outputting HTML Reports

PowerShell can export results as HTML. Simply pipe the results to ConvertTo-HTML and save the result in a file. When you do that, it is wise to use...

read more

Add Custom Properties

While objects contain a wealth of information, this information sometimes isn't in the right format. Let's take WMI objects representing...

read more

Free Space on Disks

You can use WMI to determine how much free space is available on any given disk: Get-WMIObject Win32_LogicalDisk | Foreach-Object { 'Disk {0}...

read more

Order Matters

Here is a challenge for you. The following code is a simple currency converter. However, when you run it, you'll notice it doesn't convert...

read more

Accessing Date Methods

While Get-Date returns the current date and time, it really returns a DateTime object. You can use this object to find out more about the date or to...

read more

Using Cultures

Since PowerShell is culture-independent, you can pick any culture you want and use the culture-specific formats. The following script instantiates...

read more

Accessing Static .NET

You can start to explore the power of .NET with PowerShell's built-in .NET access.. All you will need are square brackets to access static...

read more

Arrays of Strings

In PowerShell, you can multiply strings: the string is repeated which can be useful for creating separators: '-' * 50 This works for words,...

read more