Powershell

Chaining Type Conversions

In PowerShell, you can do multiple sequential type conversions. For example, you should first convert the string into a character array and then...

read more

Type Accelerators

PowerShell has a few shortcuts for popular .NET types like [WMI], [ADSI] or [Int]. You should read the FullName property if you'd like to know...

read more

Comparing Versions

When you compare version strings, PowerShell will use alphanumeric algorithms, which may lead to confusing results: '3.4.22.12' -gt...

read more

Converting Object Types

Once you know the name of an object type, you can use that type for conversion. The next line converts a string into a date-time type: [DateTime]...

read more

Validate Set of Inputs

If you need to limit a function parameter to only a set of allowed choices, you should use the next example: function Get-24hEventLogEntries...

read more

Remove Recents Folder

Windows uses the special recents folder to remember which files you have opened. You can have a look to check what Windows has stored: Dir...

read more

Displaying Hex Dumps

PowerShell can read plain text, but it can also read binary content. Here is a little function that creates a "hex dump" of any binary...

read more

Working with Path Names

The .NET System.IO.Path class has a number of very useful static methods that you can use to extract file extensions. Here is how you can get a list...

read more