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...
powertips
Using BITS to Download Files (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...
Investigating PowerShell Console Output
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...
Identifying Origin of Network Access
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...
Exploring Folder Structures (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...
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...
Decoding Windows Product Key (Part 2)
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...
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...
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...