When PowerShell asks Windows for updates via the Microsoft.Update.Session object, some information seems to be unreadable. The code below dumps...
Powershell
Finding Installed Updates (and searching for missing) (Part 1)
Windows can automatically determine the updates that may be missing on your system, provided you have an Internet connection. PowerShell can use the...
Auto-Logging Command Output
In the previous tip we introduced the PreCommandLookupAction supported by PowerShell 3 and better. Today we have a special implementation for you....
Replacing Commands
PowerShell comes with a couple of “secret” (better: under-documented) settings. One is PreCommandLookupAction, and it gives you great...
Easy Parsing of Setting Files (Part 3)
In the previous tip you have discovered how ConvertFrom-StringData can turn plain text key-value pairs into a hash table. What’s missing is...
Easy Parsing of Setting Files (Part 2)
In the previous tip we used ConvertFrom-StringData to parse plain text key-value pairs into hash tables. Here is an example where such conversion...
Easy Parsing of Setting Files (Part 1)
Let’s assume you want to save settings to a file in the most simplest form. Your settings may look like this: $settings = ' Name=Weltner...
Adding Live Clock to PowerShell Title Bar (Part 2)
In the previous tip we presented code that would update the PowerShell title bar in a background thread, displaying a live clock. Wouldn’t it...
Adding Live Clock to PowerShell Title Bar (Part 1)
To continuously update the PowerShell title bar, and for example display the current date and time, you need a background thread that takes care of...
When Add-Type Fails…
Add-Type can be used to load additional .NET assemblies from DLL files into PowerShell. This works well most of the time, and here is a sample call...
Understanding PowerShell and System Paths
PowerShell maintains its own current location: PS> Get-Location Path ---- C:\Users\tobwe The current location applies to relative paths used with...
Finding PowerShell’s Current File System Path
To find out the path your PowerShell is currently using, simply run Get-Location: PS> Get-Location Path ---- C:\Users\tobwe However, the current...
Dealing with “Windows PowerShell” and “PowerShell Core”
There are two PowerShell Editions now: “Windows PowerShell” shipping with Windows, and running on the full .NET Framework, and the...
Windows PowerShell and PowerShell Core
Lately there has been confusion about PowerShell versions. There is a “PowerShell 6” open source initiative at GitHub...
Setting PowerShell Title Text
You probably know that you can change the title text of a PowerShell host window with a line like this: PS> $host.UI.RawUI.WindowTitle =...
Clearing All User Variables
In the previous tip we illustrated how you can identify built-in PowerShell variables with an approach like this: $ps = [PowerShell]::Create() $null...
Finding PowerShell Default Variables (Part 3)
In the previous tip we illustrated how you can identify built-in PowerShell variables with an approach like this: $ps = [PowerShell]::Create() $null...
Finding PowerShell Default Variables (Part 2)
In the previous tip we explained how you can use a separate new and fresh PowerShell to retrieve all default variables. When you examine these...
Finding PowerShell Default Variables (Part 1)
Sometimes it would be useful to identify the automatic PowerShell variables managed by PowerShell so you could differentiate between built-in...
Finding PowerShell Classes
Starting in PowerShell 5, you can define PowerShell classes. They are defined dynamically and live in memory. So how would you know the names of...
Using PowerShell Classes 2
Starting in PowerShell 5, you can define PowerShell classes. You can use classes to create new objects, and by defining one or more...
Using PowerShell Classes
Starting with PowerShell 5, you can define classes. They have many use cases. One would be to create libraries of useful helper functions to better...
Reading Registry Values (Workaround)
In the previous tip we illustrated that Get-ItemProperty cannot read registry key values when there is a value present with corrupted content:...
Reading Registry Values Fails
Occasionally, reading values of a registry key may fail with a strange error message: PS> $key =...