Sometimes you might want to run some command multiple times until it runs successfully. Here is a function that shows a way to do this: #requires...
database-tools
Saving Persistent Data
Sometimes a script needs to save information in a persistent way. Maybe you have a list of computers that you'd want to contact, but only some...
March #SQLChat – “DBAs Role in Data Modeling”
We are excited to welcome the data modeling audience into IDERA! And to prove it, we are hosting a #SQLChat! IDERA’s next Twitter Chat will be held...
Use WMI the Modern Way!
WMI is a powerful technique to find out information about local or remote computers, and you may have used Get-WmiObject before to do so (if not,...
Using .NET Types Directly
Cmdlets contain pure .NET code, so thanks to cmdlets, you do not need to directly touch .NET code. You can, however. Here are a number of sample...
Using Workflows to Parallelize Code
If you want to execute more than one thing at once, there are many ways to implement this in PowerShell. One may be the use of workflows. They were...
Decorate Scripts with #requires Statements
PowerShell supports a number of #requires statements. Technically they are comments but PowerShell checks the requirements, and if they are not met,...
February #SQLChat Wrap-Up
IDERA hosted its 8th Twitter Chat on Wednesday, February 17th at 11 AM CT with Mike Fal, Senior Database Administrator for Xero. Questions focused...
Do Not Mix Different Objects!
If you do output completely different objects, you may lose information. Take a look at this example: #requires -Version 2 $hash = @{ Name =...
Getting an Excuse
Here is a quick way of getting a good excuse - provided you have Internet access: #requires -Version 3 function Get-Excuse { $url =...
Who is Listening? (Part 2)
If you run at least Windows 8 or Windows Server 2012, you can use Get-NetTcpConnection to find out which network ports are in use, and who is...
Who Is Listening? (Part 1)
The good oldfashioned netstat.exe can tell you the ports that applications listen on. The result is plain-text, though. PowerShell can use regular...
SQL Family: The Wonder Years
Last week, Bill Wolf aka @SQLWareWolf and I somehow got onto the topic of High School pictures. So in jest, I decided to post mine and hash tagged...
Sending Objects to Notepad
In a previous tip we showed how you can send text to a fresh Notepad instance. Today, you get an enhanced version of Out-Notepad: you can pipe...
Send Text to Notepad
Notepad can be used to display text results. Typically, you would need to save text results to file, then have Notepad open that file. There is a...
Magic Underscore Variable
Here is a very special (and very underdocumented) way to use PowerShell parameters. Have a look at this function: #requires -Version 2 function...
A 2016 future so bright you gotta wear shades?
If you are a DBA or developer working around Microsoft SQL Server, you have heard lots about SQL Server 2016. (If not, you might be stuck in a...
Converting Currencies
PowerShell is an extremely powerful language and can access web services and web pages. If you combine that with dynamic parameters, you get a...
Counting Pages in a Word Document
Let's assume you have a bunch of Word files and would like to know how much pages they contain. Here is a function that takes the path to one...
Bringing Window in the Foreground
PowerShell can use Add-Type to access internal Windows API functions. This way, it is easy to bring any process window into the foreground. Here is...
Process Data (Part 3)
In parts 1 and 2, you learned how a PowerShell function can process information that was submitted to parameters or piped via the pipeline. In our...
Process Data (Part 2)
In part 1 we showed how a PowerShell function can receive input both from a parameter and via the pipeline, and process it in real-time. This is the...
5 Things You Can Do in SQL Diagnostic Manager That You May Not Know
There is a library of ‘how-to’ videos created for SQL Diagnostic Manager showcasing how to perform certain tasks and how to troubleshoot specific...
Processing Data (Part 1)
This is the first of the three tips showing you how a PowerShell function can accept data via pipeline or parameter. In part 1, the function...