How can you automatically check the supported languages for an online document? Provided the URL uses a language ID, it’s easy to create a list of...
ps1
Careful with Arrays
Careful with ArraysWith PowerShell you never know whether a cmdlet returns an array or a single object. That’s because PowerShell automatically...
Creating New Code Signing Test Certificates
PowerShell comes with a cmdlet named New-SelfSignedCertificate which can create all kinds of self-signed test certificates. However, it is not...
Get Volume IDs (Part 2)
In Windows 10 and better, you can use Get-Volume to get volume IDs and other information about your drives: PS> Get-Volume DriveLetter...
Get Volume IDs (Part 1)
You can query WMI to get a list of your drives volume IDs like so: Get-CimInstance -ClassName Win32_Volume | Select-Object -Property DriveLetter,...
Asking for Masked Input (Part 2)
Never ever use plain-text input for secrets and passwords – the text entered by the user may be logged and compromised. Always use a masked input....
Finding MSI Product Codes (Part 2)
On Windows 10 and better, finding MSI packages and their product codes no longer requires WMI queries. Instead, you can use Get-Package: Get-Package...
Finding MSI Product Codes (Part 1)
If you need a list of installed MSI packages and their product codes, you can use WMI to query the information. This may take a couple of seconds:...
Using HTML to create PDF Reports (Part 3)
HTML can be a simple way of formatting data for output reports. In this last part we illustrate how you convert the final HTML report to PDF...
Using HTML to create PDF Reports (Part 2)
HTML can be a simple way of formatting data for output reports. In this second part we illustrate how you convert properties that contain arrays to...
Using HTML to create PDF Reports (Part 1)
HTML can be a simple way of formatting data for output reports. In this 3-part series, we first illustrate how you compose HTML reports, then show a...
Beware of -match
The -match operator is frequently used in scripts however not everyone seems to understand how it really works. It can be a really dangerous filter...
Avoid Add-Member (Part 3)
In the previous tip we looked at a number of clever alternatives to avoid Add-Member when creating your own new objects. While using hash tables to...
Avoid Add-Member (Part 2)
In the previous tip we looked at creating simple data objects, and it became evident that instead of using Add-Member, you can cast a hash table to...
Avoid Add-Member (Part 1)
Often the cmdlet Add-Member is used to create simple objects like this: $user = New-Object -TypeName psobject | Add-Member -MemberType NoteProperty...
Important Keyboard Shortcuts
Two of the most important keyboard shortcuts in any PowerShell environment – whether console, ISE, or VSCode – are TAB and CTRL+SPACE. TAB triggers...
Reading Recently Installed Software (Improvement #1)
In the previous tip we used Get-WinEvent to read the Windows event log system and get a list of recently installed software, similar to this:...
Logging Variable Types
As part of your debugging and quality control you may want to log the data that gets assigned to individual variables. For example, you may want to...
Converting Language IDs in Language Names
In our previous mini series we showed different approaches to get to the names of installed OS languages using different PowerShell methods. The...
Determining Language Packs (Part 3)
In part 2 of this series, you already witnessed how much easier and faster it was to query the list of installed operating system languages using...
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...
Creating World Map Graphs
If you have data related to countries, you may want to visualize and highlight this geographic data. Classic bar- and chart-graphs won’t always work...
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...
Pasting Multiple Lines in PowerShell
When you copy multiple lines of PowerShell code and paste them into a shell window, the result often is not what you expect. PowerShell starts...