PowerShell

SQL Agent 2016 Jobs Running PowerShell Scripts

SQL Agent 2016 Jobs Running PowerShell Scripts

I recently performed a side-by-side upgrade of a SQL Server 2008 R2 instance to SQL Server 2016 RTM. This particular instance had over 200 SQL Agent jobs running various PowerShell scripts. After the upgrade I had to modify nearly all…

Compare paths with PowerShell

Compare paths with PowerShell

The other day I came across the need to compare two different paths for equality. The most annoying part of this task is when the paths are directories and you need to worry about the trailing slash. PowerShell provides a…

QS-Config v2.0 Enters Open Beta: Major Refactoring

QS-Config v2.0 has passed closed beta and is now entering open beta. Feature changes / additions: Supports PowerShell v2.0 and higher. Supports SQL Server 2014. One script for all supported versions of SQL Server, rather than a script per version….

Multiple Server Management – Finding the Database Server

Multiple Server Management – Finding the Database Server

Often database administrators must ask themselves a simple, yet tedious question, “what server is that database on,” or maybe, “how many servers do we still have on SQL Server 2005?” This article will cover how to use SQL Server’s Central…

PowerShell Start-Job

PowerShell Start-Job

The Start-Job Cmdlet is a fast and extremely simple means of spawning asynchronous threads. Why do we care? Because performing parallel work is faster and our time is important. If I want to inventory the Windows services running on every…

QS-Config v2.0 coming soon

QS-Config v2.0 coming soon

Years ago I found myself frustrated with the SQL Server installation wizard. I was working for an organization where SQL Server installs were needed regularly during points in their operational cycle and often they were not cookie cutter. Tweaks were…

Running PowerShell in a SQL Agent Job

Running PowerShell in a SQL Agent Job

When creating a SQL Agent Job to execute a PowerShell script, you have to decide which way that you want the PowerShell to run. Depending upon which version of SQL Server that you are using and which job step type that you…

PowerShell Profile Tips

Automation is one of the purposes for using PowerShell. Automation is a funny thing, however. You can perform steps of automation almost to infinity. If you write a function that replaces 200 lines of code with 1 function call, that’s…

Start and Save Hyper-V VMs with PowerShell

I use Windows 8 or Windows Server 2012 R2 on most of my local workstations between home and work. In order to conserve memory, I turn my Hypver-V lab environments on and off as I need them. Given that my…

Availability Group fail-over test with PowerShell

I have a number of SQL Server Availability Groups in my organization. Of them, most are multi-site configurations for disaster recovery. Naturally, the latency that a separate data center implies is more than my application can handle for its writes….