If you have installed the free Microsoft RSAT tools, you have access to the ActiveDirectory module. Here is a simple approach to find all domain...
Powershell
Free Ebooks from Microsoft
Microsoft is giving away unlimited numbers of free ebooks on many different topics. Ebooks can be downloaded using a PowerShell script. Here are the...
Changing Network Connection Mode from Private to Public (and vice versa)
Starting with Windows Server 2012 R2 and Windows 8.1, PowerShell ships with many useful cmdlets for client and server configuration. This comes...
Removing Windows 10 Apps
PowerShell is probably the easiest way to get rid of preinstalled Windows 10 apps. If you know the name of a particular app that you want to remove,...
Launching Daily Tools via Alias
You probably know the shortcut names that PowerShell predefines: Aliases like “dir” and “ls” help you save typing in...
PowerShell 2 Now Considered Deprecated
Microsoft just announced that PowerShell 2 will soon be labeled “deprecated”. It will still be available for some time, but this is a...
Repairing Disk Drives
In the old days, disk repair was performed by chkdsk.exe. This still works. In Windows Server 2012 R2 and Windows 8.1, a new cmdlet called...
Finding Your Windows Product Key
Knowing your Windows product key can be essential when you later need to restore your computer from a backup. Here is a simple one-liner to provide...
Getting Cached Credentials
In the previous tip we talked about a public module called PSCredentialManager that helps you manage cached credentials. Sometime, less is more, so...
Playing with PowerShell Gallery Content
The public PowerShell Gallery (www.powershellgallery.com) is a place where PowerShell scripters can freely exchange scripts and modules. All you...
Calculating Folder File Size
Measure-Object can also sum up property values. This is how you determine folder size. The following code calculates the complete folder size for...
Counting Files Efficiently (Part 2)
In the previous tip we looked at how to efficiently count items like files in a folder. Here are some more examples. Counting the number of files in...
Counting Files Efficiently (Part 1)
A quick and dirty approach for counting files could be this: (Get-ChildItem -Path c:\windows).Count However, it would produce some memory load...
Uncovering TinyUrls’ True Origin
URL shortening is great for Twitter messages but hides the origin. Would you really trust http://bit.ly/e0Mw9w? Here is a simple approach that lets...
Creating Colorful Weather Report
In the previous tip we explained how you can retrieve weather forecast data using Invoke-WebRequest. This was pure black-and-white text. To get a...
Get Weather Forecast
Invoke-WebRequest can easily retrieve web page content for you. If you run it without the –UseBasicParsing parameter, the HTML is even parsed...
Avoid Read-Host
Do you use Read-Host to receive user input? If you do, rethink. Read-Host always prompts a user, and there is no way to automate scripts that use...
Using Online Help
PowerShell does not ship with help files, and installing help files locally requires Administrator privileges. A much easier approach can often be...
Outputting and Assigning at the same time
In the previous tip we talked about logging script results, and how you can assign values and at the same time output the assigned values by using...
Logging Script Output
There are numerous ways to log script output but one especially lazy technique is to run Start-Transcript. In PowerShell 5, this cmdlet is supported...
Installing Modules in PowerShell Core on Linux
When you’d like to install modules for all users from the PowerShellGet repository, you need Administrator privileges. On PowerShell Core on...
“Braces Secret” with PowerShell.exe
Here is a little secret that applies to powershell.exe when it is called from within PowerShell or PowerShell Core: when you run powershell.exe and...
Parsing Distinguished Names
Distinguished names are strings, and strings contain powerful ways of parsing data. The most powerful yet simple approach is the Split() method....
Auditing Logons
Have you ever wondered whether someone has logged into your PC while you were away? In a previous tip we explained how you can examine the rich...