In the previous tip we explained how PowerShell can play system sounds. For a bit more flexibility, PowerShell can also play arbitrary *.wav sound...
ps1
Playing Sounds
If all you need is a beep, then PowerShell can help you easily: $frequency = 800 $durationMS = 2000 [console]::Beep($frequency, $durationMS) If...
Sort IPv4 and IPv6 Addresses Correctly
When you try and sort IPv4 addresses via Sort-Object, this fails: PS> '10.1.2.3', '2.3.4.5', '1.2.3.4' | Sort-Object 1.2.3.4 10.1.2.3 2.3.4.5...
Sort IPv4 Addresses Correctly
In the previous tip we published a super-fast function called Test-OnlineFast, and this function was able to ping an entire IP segment in record...
Final Super-Fast Ping Command
In the previous tip series, we developed a new function called Test-OnlineFast that can ping multiple computers in record time. For some reason, the...
Backing Up Event Logs
There are a number of useful cmdlets to manage event logs, however one functionality is missing: PS> Get-Command -Noun EventLog CommandType Name...
Converting a Windows Error ID into Friendly Text
When you call low level functions from PowerShell, often you get back a numeric return value. If the return value came from a Windows API function,...
Finding Registered Event Log Source Names
When you write events to an event log using Write-EventLog, you must specify a valid source name. However, there is no easy way of finding out which...
Easy Logging by Using Event Logs
Often scripts need to log what they do, and PowerShell scripters invest a lot of thought and time on logging information to text files. As an...
Uncover Tiny URLs
Tiny URLs like “http://bit.ly/e0Mw9w” are short and convenient to use, however they often mask the true origin as well. PowerShell can...
Automatic Wallpaper Downloader
Are you tired of boring wallpapers for your desktop? PowerShell can get you new wallpapers! Here’s the function: function Download-Wallpaper { param...
Saving Values to Excel Sheet
Occasionally, you may have to update values in an Excel spreadsheet. PowerShell can access the Excel object model however this is quite slow. Here...
Reading Excel Cells
Occasionally, you may have to read information from Excel spreadsheets. PowerShell can access the Microsoft Excel object model albeit it is quite...
Permanently Setting Environment Variables
PowerShell can set environment variables only in its process set, so these changes will not persist and are not visible outside of PowerShell. To...
Select-Object and -ExcludeProperty
Here is a line of code that often puzzles PowerShell users: Get-Service | Select-Object -ExcludeProperty Name When you use Select-Object, its...
Forcefully Close All PowerShell ISE Documents
Here’s a code snippet that forcefully closes all open documents in the PowerShell ISE. Be aware: it closes all documents without asking to...
Creating Highspeed Ping (Part 6)
In the final part of our mini-series, we add pipeline awareness to our super-fast Test-OnlineFast function. You now can pipe computer names into the...
Creating Highspeed Ping (Part 5)
In the previous tip we created a lightning fast new PowerShell function called Test-OnlineFast which used WMI to ping any number of computers with...
Creating Highspeed Ping (Part 4)
In the previous tip we illustrated how WMI can ping multiple computers in a very fast way. So today, let’s wrap the code into a reusable...
Creating Highspeed Ping (Part 3)
In the previous tip we illustrated how WMI can ping multiple computers in a very fast way. However, the syntax was awkward. So let’s rewrite...
Creating Highspeed Ping (Part 2)
In the previous tip we illustrated how WMI can ping computers with a predefined timeout. WMI can do more: it can ping multiple computers lightning...
Creating High-Speed Ping (Part 1)
Pinging computers is a frequently needed task. The PowerShell cmdlets such as Test-Connection can do pings but do not have a timeout limit, so when...
Getting Help for PowerShell
Provided you have downloaded the PowerShell help files, there is an easy way to get help for all kinds of PowerShell topics. First, make sure you...
Exploiting Select-Object
Select-Object is a basic cmdlet that most PowerShell users use frequently. However, it has some tricks that are not well known. In its most basic...