Do you know the PSReadLine module? It’s included in PowerShell 5 and 7 by default, and this module is responsible for the convenient color...
powertips
Using Efficient Lists in PowerShell
By default, PowerShell uses simple “object arrays” when you define lists, when commands return more than one result, or when you...
Downloading Files from Internet
Invoke-WebRequest can’t just send requests to webservices. This cmdlet can communicate with remote systems and transfer data back and forth....
Defender: Purge Threat List and related Settings
By default, Windows Defender automatically purges items it identified as a threat after 15 days. This preference as well as many others can be...
Resetting Firewall Policy
If you’d like to revert firewall rules to factory defaults on Windows 10 or 11, ask PowerShell to run the appropriate netsh.exe command:...
Managing Bitlocker
Better make sure your local drives on notebooks are encrypted. This protects your personal data in case a notebook gets stolen or is placed into...
Quickly Open PowerShell for Folder
In Windows Explorer, when you navigate to a folder, you can easily open a classic cmd or a PowerShell console with the current folder set as current...
Managing File Shares on Windows with PowerShell (Part 2)
In the previous tip we introduced the PowerShell “SmbShare” module which comes with Windows and enables you to manage file shares. We...
Managing File Shares on Windows with PowerShell (Part 1)
Windows comes with a module called “SMBShare” which contains 42 cmdlets to manage network shares. This module works with Windows...
Custom Console-Based Dialog
Using 3rd party dialogs isn’t always a good choice. Reusing the built-in PowerShell dialogs can be much more fun. Here is a function called...
Hibernate or Standby via PowerShell
In the previous tip we illustrated that while it is hard to directly access the Windows Power Management API, there are other API calls that can do...
Detecting Power Status
While it is hard to directly access the Windows Power Management API, there are other API calls that can do this for you. The following one-liner...
Detecting Unplanned Shutdown
If Windows crashes or is otherwise stopped unexpectedly, when it restarts the next time, it logs a kernel error with ID 41. If you’d like to...
Strange Cmdlet: New-TemporaryFile
Here’s a cmdlet that sneaked into PowerShell (and Windows PowerShell) and remained almost unnoticed: New-TemporaryFile. It’s amazing to...
Localizing Date and Time Labels (Part 2)
In the previous tip we explained how you can see all supported Windows cultures and have Windows translate weekday names. Let’s have some more...
Localizing Date and Time Labels (Part 1)
Windows comes with built-in support for various cultures. Here is the list of supported cultures and their short name: PS>...
Calculate Calendar Week (Part 2)
In the previous tip we explained how to calculate the calendar week for a given date. As you have seen, this depends on culture and calendar...
Calculate Calendar Week (Part 1)
Calculating the week of day isn’t trivial and can be different for different cultures. Here is a generic way to calculate the week number for...
Creating Calendar Spreadsheets with PowerShell
Ever needed to plan recurring meetings for your club, community or hobby? Sure, there are tons of online tools to help you but if you’d just...
Open Windows Shutdown Dialog
Here is a one-liner that opens the Windows shutdown dialog: (New-Object -ComObject Shell.Application).ShutdownWindows() And with this one-liner, it...
View All Module Details
powershellgallery.com is a great place to find new free PowerShell extension modules that add new cmdlets to your PowerShell. However, it can become...
Identifying Primary PowerShell Module Location
PowerShell is just a scripting engine. All of its cmdlets come from external modules, and the environment variable $env:PSModulePath returns the...
Testing Well Formed URLs
PowerShell is API-based so often, you don’t need to dive into regular expressions and text patterns. Instead, there is a multitude of...
Running on Windows PowerShell – Or Not? (Part 2)
In the previous tip we featured a backward-compatible one-liner that can tell whether your script is running in the classic Windows PowerShell...