There are a number of useful cmdlets to manage event logs, however one functionality is missing: PS> Get-Command -Noun EventLog CommandType Name...
powertips
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...
Reading RunOnce Key
The RunOnce key in the Windows Registry stores all auto-starting executables. It may be empty. To check for auto-starting applications, try this:...
Creating Random Passwords
Here is another small script to produce random passwords consisting of a defined number of capitals, letters, numbers, and special characters:...
Converting PowerShell to Batch
Here is a fun PowerShell function called Convert-PowerShellToBatch. Provide it with the path to a PowerShell script, or pipe in the results from...
Piping Files and Folders
Let’s assume you want to create a function that accepts a file path. There are numerous tasks that can be done with files. You may want to...
Simple WMI Browser
WMI is a powerful information repository – if you know the names of WMI classes: Get-CimInstance -ClassName Win32_BIOS Get-CimInstance...