Here are some Cluster PowerShell Commands worth having in your arsenal. Get-Cluster This will simply show the cluster name Get-ClusterQuorum | ft QuorumType This will confirm the Quorum type in use. For an AlwaysOn configuration, this should be node majority. For a Failover Cluster Instance then this should be node Continue Reading
PowerShell
Automating SQL Installs
Here’s how I do a basic silent install of SQL Server. Configuration File You can’t start this unless you have an installation configuration file from a previous install. Your Configuration File (ConfigurationFile.ini) can be found in the following location: C:\Program Files\Microsoft SQL Server\120\Setup Bootstrap\Log\ Within this location there will be Continue Reading
2 Issues with PowerShell Steps in SQL Agent
Both of the issues I’m going to discuss have been documented before but for my own benefit I’m going to put them on my blog as they are bound to come up again one day.. Unable to start execution of step 2 (reason: line(50): Syntax error). The PowerShell Script works Continue Reading
3 Best Practices for Non-Production
When I set up a new UAT/DEV environment there are some things I tend to do: Change the DB Owner to the SA account or equivalent I do this in Production too, obviously but if you are regularly refreshing UAT databases, this can sometimes be overlooked. Change Recovery Models to Continue Reading
Automating SQL Service Packs and Cumulative Updates
Applying Service Packs and Cumulative updates is dull, mundane work. It’s hard to keep on top of sometimes and also with some 24/7 databases, it’s hard to find an update window. Sometime it’s hard to even get the business to agree to something if they’re not exactly seeing any end Continue Reading
SQLPS Error After Upgrading PowerShell
Another Error I thought that was worth blogging about. I upgraded to PowerShell 5.1 and then suddenly the SQLPS module seemed to disappear. When I start PowerShell, the SQLPS module should be automatically loaded but I received the below error. Even manually importing the module wouldn’t work. So I needed Continue Reading
SQL Agent and AlwaysON Availability Groups
So we all know that SQL Agent isn’t part of an availability group and therefore (like logins, operators, alerts, linked servers etc) your SQL jobs won’t sync. But even when they are synced, I’m sure there are plenty that should only run on the Primary Node and therefore shouldn’t run Continue Reading
ToTitleCase()
This script will come in handy again one day. It simply formats the words in a CSV file to Title Case. $Loc = C:\Users\BusinessData.csv $CSVFile = Get-Content $loc -Raw (Get-Culture).TextInfo.ToTitleCase($csvFile) | Out-File $loc
SQL and PowerShell
I’m no PowerShell expert. I wish I was. One day I hope to be better at it. This resource has helped me no end recently: DBATools.IO is a PowerShell module specifically designed for SQL Server and DBAs. It has helped me no end with New Builds, Migrations, Best Practices, Automation, Continue Reading
SQL PowerShell Profile
I’m very much new to using PowerShell in my day-to-day DBA tasks. One thing it took me a while to work out was that i had to import the sqlps module each time I started PowerShell. Then I realized that I could create a new PowerShell profile so that this Continue Reading