The following code finds all groups a given Active Directory user is member of (including nested group memberships). The code requires the...
powertips
Checking Network Connections
If your machine is connected to the internet (or VPN) via different network connections, depending on where you are, then the following two...
Removing Bloatware from Windows 10
Windows 10 comes with all kinds of preinstalled apps and other features that may feel annoying to some. Richard Newton has created a PowerShell...
Managing FTP via PowerShell
There are no built-in FTP commands in PowerShell, but you can easily download and install a free extension that provides the missing commands. Just...
Formatting Numbers (Part 2)
In the previous tip we introduced the Get-DisplayFileSize function which automatically converts bytes to readable numbers with units such as “KB”...
Formatting Numbers (Part 1)
The following Get-DisplayFileSize function takes any byte value and returns a nicely formatted size, using units like “MB”, “GB”, or “PB”: function...
Filtering Files
You may not have noticed this, but the -Filter parameter on Get-ChildItem (aka dir or ls) is not as specific as you think. The following line should...
Using List View in a Grid View Window (Part 3)
In the previous tip we introduced ConvertObject-ToHashTable which makes it easy to dump objects in a grid view window. The code below is an improved...
Using List View in a Grid View Window (Part 2)
Out-GridView is a useful cmdlet to list many objects. It is not ideal when you just want to display a single object with all of its properties,...
Using List View in a Grid View Window (Part 1)
One of the simplest hardware inventories is probably this line: $data = systeminfo.exe /FO CSV | ConvertFrom-Csv $data | Out-GridView A more modern...
Efficiently Produce Comma-Separated Strings (Part 2)
In the previous tip we showed how you can use the PowerShell command mode to easily create lists of quoted strings. This can be really useful for...
Efficiently Produce Comma-Separated Strings
Here is a super simple approach to create a list of quoted strings: & { "'$($args -join "','")'" } hello this is a test Here is the result:...
Using a Grid View Window as a Selection Dialog (Part 2)
In the previous tip we explained how you can use a hash table to show simple selection dialogs, yet when the user selects an item, return full rich...
Using a Grid View Window as a Selection Dialog (Part 1)
How can a grid view window be used as a simple selection dialog? When you pipe objects to a grid view window, all object properties are shown. Often...
Removing User Profiles Via Dialog (Part 2)
In the previous tip we illustrated how a grid view window can display all available user profiles, lets you select one, and deletes it: #requires...
Remove User Profiles Via Dialog
We’ve received massive feedback on our tips dealing with user profile management, so we decided to add a couple of additional tips. In the...
Find User Profiles
We’ve received massive feedback on our tips dealing with user profile management, so we decided to add a couple of additional tips. Typically,...
List User Profiles
We've received a massive feedback on our tips dealing with user profile management, so we decided to add a couple of additional tips. WMI can...
Understanding and Avoiding Double-Hop
When a script is executed remotely, you can run into “Access Denied” issues that often are related to the double-hop issue. Here is an...
Using Group-Object to Separate Remoting Results
When you need to get information from multiple computers via PowerShell remoting, you could query each machine separately. A much faster way is to...
Converting Numeric Strings
Converting a string that contains a number is trivial in PowerShell: PS C:\> [double]"77.234" 77,234 PS C:\> If the string contains...
Using Default Parameter Values
You may have heard about PowerShell default parameter values and $PSDefaultParameterValues. When you assign a hash table to this special variable,...
Correctly Importing Excel CSV Files
If you have exported an Excel sheet to CSV and would like to import this file into PowerShell, here is how to do this: $path =...
Supporting Risk Mitigation in PowerShell Functions
When a PowerShell function performs system changes that may be risky, it is worth supporting the –WhatIf and –Confirm risk mitigation...