When you are connected both to a LAN and a WLAN, and would like to prefer one network over the other, you can adjust the network metric. The lower...
posts-powershell
Adding Personal PowerShell Commands to the Context Menu
You can add personal context menu commands for file types like PowerShell files. These context menu commands appear when you right-click a .ps1...
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...
Deleting Registry Keys that can’t be Deleted
Deleting registry keys is typically trivial and can be done with Remove-Item. However, every once in a while, you may come across registry keys that...
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...
Launching PowerShell Scripts for Dummies
Assume you want to hand a PowerShell script to an unexperienced user. How can you reliably get that person to correctly launch your script file?...
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...
Splitting Large Files in Smaller Parts (Part 3)
In previous tips we illustrated how you can use PowerShell to split files into smaller file chunks, and how to join the chunks to recreate the...
Splitting Large Files in Smaller Parts (Part 2)
In our previous tip we explained how you can split large files into smaller chunks. Today, we complete this with a function that takes these file...
Splitting Large Files in Smaller Parts (Part 1)
PowerShell can split large files in multiple smaller parts, for example to transfer them as email attachments. Today, we focus on splitting files....
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...
Where-Object: Just A Pipeline-Aware If-Clause
Where-Object is one of the most frequently used PowerShell commands, yet it looks unfamiliar to new PowerShell users. Those who are familiar with...
Using Custom Prompts for Mandatory Parameters
When you define mandatory parameters in PowerShell, the user gets prompted for the value if it is missing. The prompt uses the parameter name only...
Checking Cmdlet Availability and Script Compatibility (Part 3)
Not all PowerShell cmdlets ship with PowerShell. Many are part of 3rd party modules which in turn ship when you install certain software, or use...
Checking Cmdlet Availability and Script Compatibility (Part 2)
Not all PowerShell cmdlets ship with PowerShell. Many are part of 3rd party modules which in turn ship when you install certain software, or use...
Checking Cmdlet Availability and Script Compatibility (Part 1)
Not all PowerShell cmdlets ship with PowerShell. Many cmdlets are part of 3rd party modules which in turn ship when you install certain software, or...
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...
Testing Raw Data with Checksums – A Real-World Example
With PowerShell entering the IoT world, sometimes it is necessary to deal with binary sensor data and ancient checksum models to verify data...
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...
Calculating Most and Least Significant Byte
Numbers are stored internally as bytes. An Int32 value, for example, uses four bytes. Sometimes it is required to split up the number into its byte...