In the previous tip we explained how you can ask WMI for a partial Windows product key. If you have lost your original product key, here is a way to...
ps1
Decoding Windows Product Key (Part 1)
There are a lot of script examples out there and even key recovery tools that promise to return the full product key, but in many cases, the...
Reading Operating System Details
PowerShell can easily retrieve important operating system details such as the build number and version by reading the appropriate registry values: #...
Prompting for Credentials in Console
When you run Get-Credential or are otherwise prompted for a username and password, Windows PowerShell (powershell.exe) always opens a separate...
Searching PowerShell Gallery for New Modules
The official PowerShell Gallery is a public repository with thousands of free PowerShell modules. Instead of reinventing the wheel, it makes total...
Managing SharePoint Online
If you use SharePoint Online and would like to manage it via PowerShell, download and install the Microsoft.Online.SharePoint.PowerShell module from...
Identifying Compromised Passwords (Part 2)
When you want to submit sensitive information to a PowerShell function, you typically use the SecureString type. This type makes sure a user gets...
Identifying Compromised Passwords (Part 1)
Passwords are no longer considered safe when they are complex. Instead, you need to ensure that passwords have not been compromised and are not part...
Create Software Inventories
The Windows registry stores the names and details of all software that you installed. PowerShell can read this information and provide you with a...
Keep PowerShell Modules Up-To-Date
It’s important to check every now and then that your PowerShell modules are up-to-date. If you are using old and outdated modules, you can run...
Adding New PowerShell Commands
PowerShell is just a scripting platform and can be extended with new commands. A great source for new commands is the public PowerShell Gallery. You...
Getting Help for WMI Objects
WMI is extremely powerful but a little underdocumented. To change this, a group has formed and is creating a PowerShell-specific WMI reference:...
Reading Chassis SKU
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:...
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...