PowerShell 2 or better There are sometimes a lot of good reasons why you’d like to run a script by a different host. powershell.exe might be...
ps1
Creating PowerShell Web Server
All Versions Here is an example that implements a simple web server with just a few lines of code. When you run this script, you can enter one of...
Changing Password
All versions Here is a simple way how an existing user can change the password for his account. The user must know his old password and does not...
Opening PowerShell for Folder
Any version If you browsed to a folder using File Explorer, and then would like to open a PowerShell with the current folder set to the browsed...
Getting GIT tips online
Here is an example that illustrates how you access a REST API online. The script retrieves GIT tips. GIT is an open-source control system. Even if...
Creating Shortcut Drives
All PowerShell Versions Simply add a new drive to one of the file locations you often visit: # create folder if it does not exist yet $path =...
Running PowerShell Tasks with Progress Bar
PowerShell 2+ Sometimes it may take some time for a PowerShell command to complete, and while the command is working, the user gets no visual clue....
Colorful Console
PowerShell 5 PowerShell 5.0 on Windows 10 ships with a much-enhanced and colorful PowerShell console. PowerShell 5.0 on other operating systems just...
Finding AD User by SAMAccountName
PowerShell 5 The free Microsoft RSAT tools come with a full-blown ActiveDirectory module, but sometimes simple AD tasks can be mastered with just a...
Finding Nested Object Secrets
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...
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,...