database-tools

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....

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...

Finding PowerShell Functions

PowerShell 3.0 and later To quickly scan your PowerShell script repository and find all files that have a given function in them, try this filter:...

Dumping Service State Information

All PowerShell Versions If you would like to save the results of a PowerShell command to disk so that you can take it with you to another machine,...

Comparing Service Configuration

PowerShell 3 and later Provided you have PowerShell remoting up and running on two servers, here is a simple script that illustrates how you can get...

Waiting for a Keystroke

All PowerShell versions, PowerShell Console only To keep the PowerShell console open when a script is done, you may want to add a “Press Any...

Finding Errors in Scripts

All PowerShell Versions It’s never been easier to find scripts with syntax errors in them. Just use this filter: filter Test-SyntaxError {...