In Windows 10 and Server 2016, WMI added a new property that simplifies collecting chassis or enclosure SKUs. This one-liner reads the SKU for you:...
posts-powershell
Managing Automatic Reset
When a Windows system crashes, it typically reboots immediately. This is called “Automatic Reset Capability”, and with this one-liner...
Using Custom Validation Attributes
Beginning in PowerShell 5, you can create your own attributes, i.e. custom validators. They can be applied to variables (and parameters), and once a...
Testing for Metered WLAN
Ever needed to know whether you are currently connected to a metered (costly) network? Here is a quick way to check: function Test-WlanMetered {...
Using WMI Instance Paths (Part 2)
In the previous tip we showed that the new Get-CimInstance command is missing the important “__Path” property that was returned by...
Using WMI Instance Paths (Part 1)
Generally, it is the best to move away from the old and deprecated Get-WmiObject command and instead use the modern and faster CIM cmdlets like...
Installing PowerShell 7
PowerShell 7 is a portable app and can run side-by-side with Windows PowerShell. You just need to download and install it. This part is easy because...
Enabling Clickable PowerPoint Actions
Using clickable actions in PowerPoint presentations can be super useful to launch Visual Studio Code or PowerShell ISE, and seamlessly open and demo...
Manage Automatic Disk Checks
Whenever Windows detects irregularities with storage drives, it enables an automatic integrity check. For system partitions, on next boot, Windows...
Getting Available Video Resolutions
WMI can return a list of available video resolutions for your video adapter: PS> Get-CimInstance -ClassName CIM_VideoControllerResolution |...
Be Careful with Some Commands
Here are three commands often found in PowerShell scripts that you should be careful about because they can have severe side effects: exit“exit” is...
Dealing with Out-GridView Bug
Out-GridView can serve as a universal selection dialog when you add the -PassThru parameter. The one-liner below stops all services you select in...
Exploring WMI with PowerShell
The Win32_LogicalDevice WMI class represents all logic devices available in a computer, and by querying this “superclass”, you get back all the...
Adding New PowerShell Commands with Carbon
Carbon is one of the most popular free PowerShell modules available from the PowerShell Gallery. Similar to a swiss army knife, it comes with a...
Managing Updates with PSWindowsUpdate
There are many useful PowerShell modules available from the PowerShell Gallery. One helps you managing updates. To download and install it, run:...
Dynamic Argument Completion (Part 5)
In our previous tip we looked at sophisticated completion code that completed application paths. Collecting the completion values could take some...
Dynamic Argument Completion (Part 4)
In the previous tip we explained how you can use [ArgumentCompleter] to add powerful argument completers for parameters. There are limitations...
Dynamic Argument Completion (Part 3)
With the discoveries in our past tips, let’s compose a useful completion code that suggests all available programs you can launch: function...
Dynamic Argument Completion (Part 2)
In our previous tip we looked at [ArgumentCompleter] and how this attribute can add clever code to parameters that provides auto-completion values...
Dynamic Argument Completion (Part 1)
In previous tips we explained various ways of adding argument completers to your parameters. One approach used the [ArgumentCompleter] attribute and...
Listing Installed Applications (Part 2)
In the previous tip we read the registry to find out paths to applications you can launch. This approach worked well but had two flaws: first, the...
Listing Installed Applications (Part 1)
Ever wondered what the path is to launch a given application? The Windows registry has a key that stores such information: $key =...
Secret Dynamic Argument Completer
In the previous tip we introduced the lesser-known “ArgumentCompletion” attribute that can provide IntelliSense-like autocompletion to parameters....
Creating Colorful Console Hardcopies
If you’d like to hardcopy the content of a PowerShell console, you can copy and select the text, but this messes up colors and formatting. A better...