On both server and client, Windows ships with the “ActiveDirectory” PowerShell module. It adds numerous cmdlets to manage users and...
ps1
Four PowerShell Critical Prerequisites
If you are switching to a new computer, you may want to do a quick sanity check to see if PowerShell is set up correctly. Here are four things you...
Better Help in PowerShell ISE
There are still many professional scripters using the built-in PowerShell ISE editor, and it still is de facto a quick and reliable script...
Opening Windows Settings Dialogs (Fast) (Part 2)
Previously, we introduced the moniker “ms-settings:” that is supported by Start-Process and can be used to open various windows settings...
Opening Windows Settings Dialogs (Fast) (Part 1)
Most dialogs and settings in Windows can be opened directly via internal commands. The main Windows 10 settings dialog can be opened like this:...
Advanced Sorting (Part 4)
In the previous parts we illustrated how you can use script blocks to gain more control over sorting. For example, you can use the “-as”...
Advanced Sorting (Part 3)
In the previous tip you have seen how Sort-Object accepts hash tables, providing you with advanced control over the sorting. For example, this line...
Advanced Sorting (Part 2)
Sort-Object supports advanced sorting and provides much more control when you submit a hash table. The hash table can for example control sort...
Advanced Sorting (Part 1)
Sort-Object easily sorts results for you. For primitive data such as numbers or strings, simply add Sort-Object to your pipeline. This gets you a...
When Speed Matters
PowerShell is a general-purpose automation language, so it aims to be versatile and intuitive to use. Speed is not the top priority. If you do care...
Loading Text Files (Fast)
If you need to load large text files and are using Get-Content, then chances are you can save a lot of time. If you are not immediately processing...
Working with Get-WinEvent
Tuning Script Performance
If a script runs slow, it’s not always obvious what causes the delays, and where to optimize. With a PowerShell module called...
Converting Ticks to DateTime
Occasionally, date and time information are stored as “Ticks” in the format of a so-called “FileTime”. Ticks are...
Converting UNIX Time to DateTime
“Unix time” counts the seconds that have passed since 01/01/1970. For example, in Windows, you can read the installation date from the...
Creating Dynamic Parameters
Dynamic parameters are a special breed of parameters that can be shown or hidden based on runtime conditions. Your PowerShell functions could for...
Turning Text into Individual Lines (Part 3)
In the previous tip we split a chunk of multi-line text into individual lines and removed any empty lines. However, when a line isn’t really...
Turning Text into Individual Lines (Part 2)
Let’s assume your script gets text input data, and you need to split the text into individual lines. In the previous tip we suggested a number...
Turning Text into Individual Lines (Part 1)
Occasionally, you need to process multi-line text line by line. Here is an example of a multi-line string to start with: # working with...
Taking Screenshot
With types found in System.Windows.Forms, PowerShell can easily capture your screen and save the screenshot to a file. The code below captures your...
Disabling Local “Guest” Account
Windows comes with the built-in account called “Guest”. Since this account is seldomly used, you may want to disable it. Else, its...
Renaming Local Administrator Account
For security reasons, you may want to consider renaming the built-in local Administrator account. This account is very powerful, and its name is...
Identifying Local Administrators Group
Any member of the built-in Administrators group has access to extensive privileges, so checking the members of this group can be part of a security...
Identifying Local Administrator Account
There are a few default accounts on Windows machines such as the local “Administrator” account. While this account exists by default,...