PowerShell 2+ Objects can have a nested and complex inner structure, and it can be tiresome to examine properties one by one. Here is a simple...
Powershell
Checking Success of Command
PowerShell 3+ Often, all you want is suppress errors, and find out whether a given cmdlet worked or not. Here is a very simplistic approach that...
Creating Parameters with Dynamic IntelliSense
PowerShell 3+ Today, we dive a little deeper in the programming part, and show you how a PowerShell function can have parameters that have dynamic...
Getting New NTFS Cmdlets
PowerShell 3+ / PowerShellGet In the previous tip we explained PowerShellGet. This module ships with PowerShell 5.0 but is available for download on...
Exporting Modules across the Network
PowerShell 3+ Did you know that you can easily export modules from other computers to your local machine? Assume you don’t have the RSAT tools...
Debugging Other PowerShell Processes
PowerShell 5 Beginning with PowerShell 5.0, the PowerShell ISE can connect to other processes that run a PowerShell runspace, display the source...
Use CredSSP to Fight Double-Hop Networking Issues
PowerShell 2+ If you do PowerShell remoting, you may have experienced “double-hop” problem. It occurs when you try to pass on your...
Reading NTFS Permissions
PowerShell 2+ NTFS permissions are represented by complex object hierarchies that are hard to read. A much simpler way is to output the structure in...
New Delayed Output in PowerShell 5.0
PowerShell 2+ Let’s do two things. First, have a look at a useful small new function that does DNS resolution. Then, let’s discuss why...
Creating Your Private PowerShellGet Repository
PowerShell 3+ / PowerShellGet In the previous tip we introduced PowerShellGet and showed how you can install this module from...
Test-Driving PowerShellGet Module
PowerShell 3+ PowerShell 5.0 ships with a new module called PowerShellGet, and on older PowerShell versions, you can easily download and install...
Type-Based Parameter Binding (Part 2)
PowerShell 2+ In a previous tip we introduced automatic type-based parameter binding. Here is a use case. The function Test-Binding accepts files...
Understanding Type-Based Parameter Binding
PowerShell 2+ PowerShell can automatically bind arguments to parameters based on type. Simply define different parameter sets. Here is an example:...
Find All Writeable Object Properties
All Versions .NET objects often have properties that you can read to retrieve information. Some of these properties may actually be writeable, so...
Creating Custom Mandatory Parameters
All Versions While you can declare a parameter as mandatory, this leaves not much control to you. If the user omits the mandatory parameter,...
Use a Shorter Prompt
All Versions By default, PowerShell displays the current path in its input prompt which wastes as lot of space. When you overwrite the...
Doing Things in Parallel
Any version By processing things in parallel rather than sequential, a script can complete much faster. Here is an example that uses background jobs...
More Splitting Fun
In the previous tip, we explained how you can use a regular expression to split strings in groups of a given length. Let’s explore what else...
Splitting Groups
All PowerShell Versions Ever wanted to split a string in chunks of a given length? Regular expressions can help. Here is an example that splits a...
Using Form-Based Windows in PowerShell
WPF-based windows are the preferred way to create user interfaces this way - because the code is much easier to write, shorter, and WPF scales well...
Safely Opening WPF Windows
In the previous tip we explained how you can create WPF-based windows in PowerShell. However, when you play with WPF code inside PowerShell ISE, it...
Creating WPF Windows
WPF is a great technique to create user interfaces in PowerShell. Most of the window content can be defined using XAML, a description similar to...
Sending Emails (and Diagnosing Mail Servers)
Send-MailMessage has been around for many years. It can be used to quickly send an email without the need to have an email client at hand. All you...
Saving Multiple Credentials
Thanks to Jaap Brasser’s finding, here is an easy way of encrypting a bunch of credentials: $CredPath = "$home\Desktop\mycreds.xml"...