database-tools

Fun with Date and Time

Get-Date can extract valuable information from dates. All you need to know is the placeholder for the date part you are after. Then, repeat that...

read more

Chapter 14. XML

In today’s world, data is no longer presented in plain-text files. Instead, XML (Extensible Markup Language) has evolved to become a de facto...

read more

Counting Work Days

Ever wanted to know how many days you need to work this month? Here's a clever function that lists all the weekdays you want that are in a...

read more

Converting to Hex

Here's a simple way to convert a decimal to a hex representation, for example, if you want to display an error number in standard hexadecimal...

read more

Chapter 12. Managing Scope

Anything you define in PowerShell - variables, functions, or settings - have a certain life span. Eventually, they expire and are automatically...

read more

Chapter 10. Scripts

PowerShell can be used interactively and in batch mode. All the code that you entered and tested interactively can also be stored in a script file....

read more

Showing MsgBox

Ever wanted to display a dialog box from PowerShell rather than spitting out console text? Then try this function: function Show-MsgBox { param (...

read more

Chapter 8. Loops

Loops repeat PowerShell code and are the heart of automation. In this chapter, you will learn the PowerShell loop constructs. Topics Covered:...

read more

ASCII Table

Here’s a simple way of creating an ASCII table through type casting: 32..255 | ForEach-Object { 'Code {0} equals character {1}' -f $_, [Char]$_ }...

read more

Chapter 7. Conditions

Conditions are what you need to make scripts clever. Conditions can evaluate a situation and then take appropriate action. There are a number of...

read more

Pipeline Used Or Not?

Sometimes you may want to know if your function received parameters over the pipeline or direct. Here is a way to find out: function test {...

read more

Validate IP Addresses

You can use regular expressions and the –match operator to validate user input. Here’s a loop that keeps asking until the user enters a...

read more

Chapter 3. Variables

It is time to combine commands whenever a single PowerShell command can't solve your problem. One way of doing this is by using variables....

read more

Converting UNIX Time

Surprisingly, when you read some values from the Windows Registry, they do not seem to be in a readable format: $key =...

read more