database-tools

Sort With PS Code

Sort-Object is a great and versatile cmdlet to sort anything you want. Simply specify the property or properties you want to use for sorting: Dir...

read more

Splitting Text Into Words

If you ever need to read in a file and split file content into words, there are a couple of gotchas to keep in mind. First off, remember that...

read more

Passing ByRef vs. ByVal

Usually, when you assign a variable to another variable, its content is copied. Here is an example: $a = "Hello"$b = $a$a = "Hello...

read more

Ejecting CDs

PowerShell can still use COM libraries. Simply use New-Object -comObject and provide the COM library name to load it. With this approach, you can do...

read more

Deleting Aliases

As you may know aliases are shortcuts to other commands. So, you can easily add new aliases like this: Set-Alias edit notepad.exe The next time you...

read more

Creating Text Files

PowerShell offers you a multitude of ways to write information to disk. Here's a quick overview. 1. You can use classic redirection:...

read more

Accessing Internet Explorer

Accessing Internet Explorer can be useful for obtaining Web content. The usual approach uses a COM object called InternetExplorer.Application like...

read more

Detect DHCP State

You can use WMI and Win32_NetworkAdapterConfiguration to determine whether a computer uses DHCP to acquire an IP address. Simply look for all...

read more

Select Folder-Dialog

Want to provide your users with a neat dialog to select folders? Simply use a COM object called Shell.Application, which provides the...

read more

Sending Simple SMTP Mail

You need to notify an admin that something happened or something is finished and would like to send a quick e-mail from inside your PowerShell...

read more

Check Online Status

When managing more than just one system, you may want to remotely access those systems. Maybe you use WMI to do that. However, when you try and...

read more