Windows 8.1 Pro/Enterprise or Server 2012 R2 Both Windows 8.1 and Server 2012 R2 come with a vast number of additional cmdlets, some of which can be...
powertips
Looking Up Cryptic Error Codes
All PowerShell versions Often, WMI and API calls return cryptic numeric error codes. To find out what went wrong, try this little helper function:...
Converting Error Numbers
All PowerShell Versions Error numbers that are returned by Windows API calls often appear as very large negative numbers. To give meaning to these...
Creating HTML Colors
All Versions To convert decimal color values to a hexadecimal representation, like the one used in HTML, try this line: PS>...
Getting Help
PowerShell 3.0 and later Provided you have downloaded PowerShell help via Update-Help, you can create yourself an excellent help topic viewer with...
Break Into Script with PowerShell 5.0
PowerShell 5.0 Preview As you might know, PowerShell 5.0 Preview is available and comes with vast debugging improvements. One is to be able to debug...
Watch Rick Astley Dance and Sing!
All PowerShell Consoles (not PowerShell ISE) Before you try this, you may want to click the icon in the upper left corner of the PowerShell title...
Enabling and Disabling PowerShell Remoting
PowerShell 3 and later If you want to access a computer remotely via PowerShell, then on the destination side (on the computer you want to visit),...
Reading System Logs from File
All PowerShell Versions Sometimes, you may have to evaluate system log files that have been exported to disk, or you want to read a system log file...
WMI Search Tool
All PowerShell Versions WMI is a great and powerful technique: simply specify a WMI class name, and back you get all the instances of that class:...
List All Information
All PowerShell Versions Most of the time, PowerShell will not show you the complete results that you get from cmdlets. Instead, PowerShell limits...
Getting US ZIP Codes
All PowerShell Versions Ever wanted to find out the ZIP code of a city, or vice versa find out the city that belongs to a ZIP code? Then simply ask...
Reading Registry Values with Type
All PowerShell Versions Reading all registry values is simple when you do not need the data type: simply use Get-ItemProperty: Get-ItemProperty...
Finding Files plus Errors
All PowerShell Versions When you use Get-ChildItem to recursively search directory paths for files, you may stumble across subfolders where you do...
Finding Changeable Properties
All PowerShell Versions When you get back results from PowerShell cmdlets, the results are objects and have properties. Some properties can be...
Getting a Variable Inventory
PowerShell ISE 3 and later For documentation purposes, you may want to get a list of all variables that a PowerShell script uses. Here is a function...
Renaming Variables
PowerShell ISE 3 and later Here is a simple variable renaming function that you can use in the built-in ISE editor that ships with PowerShell 3 and...
Normalizing Line Endings
All PowerShell Versions When you download files from the Internet, you may run into situations where the file won’t open correctly in editors....
Identifying Network Vendors by MAC Address
All PowerShell Versions Each MAC address uniquely identifies a network device. The MAC address is assigned by a network equipment vendor. So you can...
Getting MAC Addresses
All PowerShell Versions Getting the MAC of a network adapter is rather simple in PowerShell. Here is one of many ways: PS> getmac /FO CSV |...
Advanced Text Splitting
All PowerShell Versions When you use the –split operator to split text, then the split text is consumed: PS> 'Hello, this is a text,...
Text Splitting
All PowerShell Versions With the –split operator, you can split text at given locations. The operator expects a regular expression, so if you...
Replacing Duplicate Spaces
All PowerShell Versions To eliminate any duplicate space, try this regular expression: PS> '[ Man, it works! ]' -replace...
Creating TinyURLs
All PowerShell Versions You probably have heard about shortening long URLs. There are plenty of free services available. Here is a script that turns...