database-tools

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

Understanding Trap Scope

Traps are a great way of handling errors but you may want to control where PowerShell continues once an error occurs. There is a simple rule: a trap...

read more

Validate User Input

When you ask users for input you never know what they enter so it is a good idea to validate user input before using it. A great and easy way to do...

read more

Multidimensional Arrays

PowerShell supports two types of multi-dimensional arrays: jagged arrays and true multidimensional arrays. Jagged arrays are normal PowerShell...

read more

Finding System Folders

When you automate file system tasks, you may want to know where special folders such as MyPictures or Documents are located. The .NET class...

read more

Finding the Current User

Should you try and use PowerShell as a log-on script, you may want to know who is actually running the script to access user specific folders or...

read more

Finding Old Files

Occasionally, you might want to find files that are older than a give number of days to delete or backup those. A simple filter can provide that...

read more

Working with Arrays

Creating arrays in PowerShell is easy using the comma delimiter. The next line creates an array with five elements: $myArray = 'Hello', 12,...

read more

Finding Duplicate Files

Hash Tables are a great way to find duplicates. Simply use the Hash Table as lookup to see if the file (or element) was already added to the Hash...

read more

Sorting Hash Tables

Hash Tables store key-value pairs, and you normally cannot sort its content. Let's define a Hash Table first to examine this: $hash =...

read more

Using Hash Tables

Hash Tables are a great way to organize data. A hash table stores key-value-pairs. To create a new hash table variable, try this: $person = @{} You...

read more

Strongly Typed Variables

Unless you override how PowerShell stores variable content, you may find that PowerShell does not automatically pick the best type. For example,...

read more