PowerShell can test user account passwords for you. This works both for local and domain accounts. Here is a sample function called Test-Password:...
ps1
Reading 4K-Hash
Windows operating systems can be uniquely identified by a so-called 4K-Hash: this is a special hash string that is 4000 bytes in size. You can use...
Sophisticated Battery Report
If your laptop battery is going low too soon, or you’d like to investigate related issues, there is a simple way to generate an extensive...
Adding PowerShell commands for SharePoint
The PowerShell Gallery provides easy access to additional PowerShell commands. For example, you can download and install the command extension for...
Adding PowerShell commands for Azure
To manage and automate your assets in the Azure cloud, you can easily install a free PowerShell module which comes with a wealth of new PowerShell...
Showing Wi-Fi SSIDs
In the previous tip we illustrated how you can dump all Wi-Fi profile names using netsh.exe. Typically, profile names and SSIDs are identical....
Dumping Wi-Fi Passwords
In the previous tip we used netsh.exe to dump Wi-Fi profiles. Let’s take it a step further and expose the cached passwords: # get cleartext...
Showing Wi-Fi Profiles
PowerShell is not limited to cmdlets and can run executables. For example, there is no built-in cmdlet to list the existing Wi-Fi profiles, but...
Redirecting Streams
PowerShell writes output information to six different streams, and only the output stream is assigned to variables: function Invoke-Test {...
Silencing Write-Host Statements
Write-Host is an extremely useful cmdlet to output information to a user because this output cannot be discarded: function Invoke-Test {...
Discarding Streams
PowerShell outputs information via different streams. Warnings are written to a different stream than output, and errors again go to a different...
Discarding (Any) Output
There are (a few) commands in PowerShell that output information to the console no matter what you do. Neither redirection of streams nor assigning...
Identifying Operating System Details
WMI returns a cryptic number when you ask for operating system details: PS> Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object...
Identifying Windows Type
Boot and Install Time for Operating System
The WMI class Win32_OperatingSystem provides rich information about a number of datetime information, including the date of last boot-up and the...
Changing Operating System Description
Each Windows operating system has a description, and you can view (and change) this description with the following command: PS> control sysdm.cpl...
Showing Object Data as Table in a Grid View Window
Typically, when you output a single object to Out-GridView, you get one line, and every property surfaces as a column: Get-ComputerInfo |...
Removing Empty Properties
WMI and Get-CimInstance can provide you with a lot of useful information but the returned objects often contain a number of empty properties: PS>...
Using Assertions
Often, your code needs to assert certain prerequisites. For example, you may want to ensure that a given folder exists, and use code like this: #...
Wake On LAN
There is no need for external “Wake On LAN” tools. If you want to wake up a network machine, simply tell PowerShell the MAC address of...
Converting Hex Numbers
PowerShell can interactively convert hexadecimal numbers when you prefix “0x”: PS> 0xAB0f 43791 If the hex number is stored in a...
Auto-Learning Argument Completion
Argument completion is awesome for a user because valid arguments are always suggested. Many built-in PowerShell commands come with argument...
Adding Argument Completion (Part 2)
In the previous tip we talked about the new [ArgumentCompletions()] attribute that was added to PowerShell 7, and how you can use it to add...
Adding Argument Completion (Part 1)
Adding argument completion to your PowerShell function parameters can improve the usability of your functions tremendously. A common approach is...