One of the big pitfalls in PowerShell code is the automatic variable $PSScriptRoot which always holds the path to the folder the current script is...
Powershell
Downloading Files
Simple file downloads can be done in a variety of ways, i.e., using Invoke-RestMethod, Invoke-WebRequest, or via the BitsTransfer module. If you...
Recovering Wasted Hard Drive Space
When software receives updates, it often does not clean up previous updates that are no longer required. These deprecated “patch files” accumulate...
The Value of Objects
This is a reprint of an article published earlier this year in my premium PowerShell newsletter, Behind the PowerShell Pipeline. This is a sample of...
Cleaning Up PowerShell Modules (Part 3)
In part 1 and 2 we looked at removing PowerShell modules altogether. In this last part we’ll look at PowerShell module versions you may no longer...
Cleaning Up PowerShell Modules (Part 2)
In part 1 we looked at removing PowerShell modules that were originally installed via “Install-Module”. You can as well remove PowerShell modules...
Cleaning Up PowerShell Modules (Part 1)
There are plenty of scripts available that promise to read the original Windows 10 product key from the registry by converting a series of binary...
Quickly Finding Outdated PowerShell Modules
In the most simplistic case, you can check all your installed modules for updates with just a one-liner (remove -WhatIf to actually perform the...
Unblocking Multiple Files
When you download files from the internet, or when you copy files from untrusted sources to an NTFS-formatted drive, Windows adds a secret NTFS...
Major Update for PowerShell Extensions
If you have tried VS Code in the past but were disappointed because of speed and stability, you may want to have a second look now. On May 3, Sydney...
Identifying Multi-Language Online Documents (Part 1)
In the previous tip we pointed you to the official PowerShell Language Definition which is available online in many different languages. Which...
Worth a Read: PowerShell Language Definition
Today I like to point you to the official Microsoft PowerShell Language Definition. As a seasoned PowerShell scripter, you can gain a lot of inside...
Resolving URLs
URLs aren’t always (directly) pointing to a resource. Often, URL act as shortcuts or static addresses that always point to latest versions....
Using PowerShell Your Way
I’ve often told people that I spend my day in a PowerShell prompt. I run almost my entire day with PowerShell. I’ve shared many of the tools I use...
Simple Text-Based Filtering a la grep (Part 1)
PowerShell is object-oriented so there’s not much text filtering and regex magic required compared to Linux and grep. Yet occasionally, it would be...
Better PowerShell Properties
I was chatting with my friend Gladys Kravitz recently about some PowerShell scripting she was doing with Active Directory and the DirectorySearcher...
Reading Windows 10 Product Key
There are plenty of scripts available that promise to read the original Windows 10 product key from the registry by converting a series of binary...
Creating sudo for PowerShell (Part 2)
In our effort to create a sudo command for PowerShell – to elevate individual commands – in part 1 we created the sudo function body: function sudo...
Creating sudo for PowerShell (Part 1)
In Linux shells, there’s a command called “sudo” that lets you run a command with elevated privileges. In PowerShell, you’d have to open a...
Code-Signing PowerShell Scripts (Part 3)
In the previous parts, we created a code signing certificate and used it to add a digital signature to a PowerShell script file. Yet what good can a...
Code-Signing PowerShell Scripts (Part 2)
In our previous tip we explained how you can use New-SelfSignedCert to create a self-signed code signing certificate. Today, we’ll use a self-signed...
Code-Signing PowerShell Scripts (Part 1)
Adding a digital signature to a PowerShell script is no black magic anymore these days, and while you ideally need an official “trusted” code...
Professional Error Handling
Often PowerShell scripts use a very simple form of error reporting that is structured like this: # clearing global error list: $error.Clear() #...
Cleaning Hard Drive (Part 2)
In the previous post we introduced the Windows tool cleanmgr and its parameters /sageset and /sagerun that you can use to define and run automated...