powertips

Creating ISO Files

PowerShell can turn regular folders into ISO files. ISO files are binary files that can be mounted and then behave like a read-only CD-ROM drive. In...

Automating Defender Antivirus (Part 2)

On Windows, PowerShell comes with cmdlets to automate the built-in antivirus engine “Defender”. In this second part, let’s take a look at how you...

Converting Wavelength to RGB

PowerShell is a generic script language so you can do all kinds of stuff with it. Below is a function that takes a light wavelength and converts it...

Querying Advanced Printer Info via SNMP

Many network printer support SNMP to query information about the device, i.e. its serial number, the status and paper sizes of installed trays, or...

Determining Language Packs (Part 1)

Let’s assume you need to find the installed language packs for a Windows machine. In this three-part series, we use PowerShell’s features to tackle...

Running $PSScriptRoot in Selected Code

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...

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...

Using BITS to Download Files (Part 1)

BITS (Background Intelligent Transfer System) is the technique used by Windows to download huge files such as operating system updates. You can use...

Launching PowerShell Scripts Invisibly

There is no a built-in way to launch a PowerShell script hidden: even if you run powershell.exe and specify -WindowStyle Hidden, the PowerShell...

Simple PowerShell Chat

Here’s a fun PowerShell script that you can use to create a simple multi-channel chat room. All you need is a network share where everyone has...

Converting SecureString to Text

It can be very useful to be able to convert an encrypted SecureString back to a plain text. This way, for example, you can use PowerShell’s...

Converting HTTP Response Codes

In the previous example we created a small PowerShell function that checks web site availability, and as part of the test results, a HTTP response...

Finding Hidden PowerShell Applications

The most widely known PowerShell hosts are certainly powershell.exe and powershell_ise.exe because they ship out-of-the-box. However, there can be...

Using FileSystemWatcher Asynchronously

In the previous tip we looked at the FileSystemWatcher object and how it can monitor folders for changes. To not miss any changes, however, an...

Finding PowerShell Named Pipes

Each PowerShell host running PowerShell 5 or better opens a “named pipe” that you can detect. The code below identifies these named...

Using a Queue instead of a Recursion

Rather than calling functions recursively, you may at times want to use a Queue object that you can load with fresh tasks while you are unloading...

Locking the Screen with PowerShell

Here is a PowerShell function called Lock-Screen that can lock the screen and prohibit user interaction. There can be a custom message, and the...

Passing Arguments to Encoded Commands

Encoding PowerShell code is a great way to run PowerShell code outside the PowerShell environment, i.e. in batch files. Here is some sample code...

1 2 3 5