Today I like to point you to the official Microsoft PowerShell Language Definition. As a seasoned PowerShell scripter, you can gain a lot of inside...
ps1
Resolving URLs
URLs aren’t always (directly) pointing to a resource. Often, URL act as shortcuts or static addresses that always point to latest versions....
Simple Text-Based Filtering a la grep (Part 1)
PowerShell is object-oriented so there’s not much text filtering and regex magic required compared to Linux and grep. Yet occasionally, it would be...
Reading Windows 10 Product Key
There are plenty of scripts available that promise to read the original Windows 10 product key from the registry by converting a series of binary...
Creating sudo for PowerShell (Part 2)
In our effort to create a sudo command for PowerShell – to elevate individual commands – in part 1 we created the sudo function body: function sudo...
Creating sudo for PowerShell (Part 1)
In Linux shells, there’s a command called “sudo” that lets you run a command with elevated privileges. In PowerShell, you’d have to open a...
Code-Signing PowerShell Scripts (Part 3)
In the previous parts, we created a code signing certificate and used it to add a digital signature to a PowerShell script file. Yet what good can a...
Code-Signing PowerShell Scripts (Part 2)
In our previous tip we explained how you can use New-SelfSignedCert to create a self-signed code signing certificate. Today, we’ll use a self-signed...
Code-Signing PowerShell Scripts (Part 1)
Adding a digital signature to a PowerShell script is no black magic anymore these days, and while you ideally need an official “trusted” code...
Professional Error Handling
Often PowerShell scripts use a very simple form of error reporting that is structured like this: # clearing global error list: $error.Clear() #...
Cleaning Hard Drive (Part 2)
In the previous post we introduced the Windows tool cleanmgr and its parameters /sageset and /sagerun that you can use to define and run automated...
Cleaning Hard Drive (Part 1)
Part of Windows is an ancient tool that can clean your hard drive: cleanmgr.exe. This tool can remove a variety of data garbage and at times removes...
Managing Bluetooth Devices (Part 3)
If you’d like to programmatically unpair a paired Bluetooth device, then there is no built-in cmdlet available. Still PowerShell can do the trick,...
Managing Bluetooth Devices (Part 3)
If you’d like to programmatically unpair a paired Bluetooth device, then there is no built-in cmdlet available. Still PowerShell can do the trick,...
Managing Bluetooth Devices (Part 3)
If you’d like to programmatically unpair a paired Bluetooth device, then there is no built-in cmdlet available. Still PowerShell can do the trick,...
Leveraging WMI (Part 3)
The new Get-CimInstance cmdlet lets you query WMI locally, and there is (limited) support for remote queries: you can specify the -ComputerName...
Managing Bluetooth Devices (Part 2)
If you’re just looking for a quick way in Windows to pair and unpair Bluetooth devices, try this command: PS> explorer.exe...
Managing Bluetooth Devices (Part 1)
Identifying Bluetooth devices that your computer has connected to is as easy as a one-liner: PS> Get-PnpDevice -Class Bluetooth Status Class...
Leveraging WMI (Part 5)
WMI classes are organized in so-called namespaces that start at “root” and work like a directory structure. The default namespace is rootcimv2, and...
Leveraging WMI (Part 4)
The secret to successfully leveraging WMI is knowing the class names that represent what you are after. In the previous tip we explained how to use...
Leveraging WMI (Part 2)
In the previous tip we introduced the PowerShell “SmbShare” module which comes with Windows and enables you to manage file shares. We looked at the...
Leveraging WMI (Part 1)
In the previous tip we introduced the PowerShell “SmbShare” module which comes with Windows and enables you to manage file shares. We looked at the...
More Control with Strict Mode
In the previous tip we introduced the PowerShell “SmbShare” module which comes with Windows and enables you to manage file shares. We looked at the...
Managing Wi-Fi Profiles
In the previous tip we introduced the PowerShell “SmbShare” module which comes with Windows and enables you to manage file shares. We looked at the...