Powershell

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

Blocking User Input

If a PowerShell script needs to perform critical steps, and user interaction must be prohibited, you can use API calls to temporarily disable all...

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

Repairing PowerShell Context Menus

When you right-click a PowerShell script in File Explorer, you typically find a context menu entry called “Run with PowerShell” which...

Repairing PowerShellGet Publishing

If you are using Publish-Module to publish your modules to a PowerShell repository, and you keep getting exceptions about unsupported commands, it...

Sending Mails via Outlook

To send mails via PowerShell, you can use Send-MailMessage. However, this requires that you have access to an SMTP server, and mails sent this way...

Mind Jogging Generator

The human mind can read sentences even if the characters are scrambled as long as the first and last letter of each word stays intact. Here is a...

Speeding Up the PowerShell Pipeline

PowerShell scripts can grow very slow when you (a) need to process a lot of items and (b) you are using the PowerShell pipeline. Let’s today...

Colorful ASCII-Art from Images

In the previous tip we showed you how you can take any image or photo and turn it into a black&white ASCII art. Today, we have a revised...

Inverting Bits

Occasionally it is necessary to invert the bits for a number. Most often, this is part of custom algorithms or checksum calculations. It raises the...

Accepting Parameters without Quotes

In the previous tip, we introduced a function that generates nicely centered headers and accepted a single string. Here is the function and its...

Creating Aligned Headers

Reporting and writing log files is a common task in PowerShell. Here is a simple function to create nicely centered headers. Adjust $width to the...

Managing Windows License Key (Part 4)

Slmgr.vbs is an ancient VBScript used to automate Windows license management. In the previous tip we started bypassing slmgr.vbs by reading the WMI...

Managing Windows License Key (Part 3)

Most Windows license and activation tasks can be automated using an ancient VBScript called slmgr.vbs. It does not make much sense to use this tool...

Managing Windows License Key (Part 2)

Most automated license key management tasks are done via a command called slmgr. This command is actually an ancient VBScript. To read all of your...

Managing Windows License Key

Let’s start this mini-series with a one-liner that extracts your Windows license key: PS> $key = (Get-WmiObject -Class...

Create ASCII Art

It’s amazing how versatile PowerShell is: with just a couple of lines of code, you can turn any photo and image into a piece of ASCII art....

1 18 19 20 21 22 104