Stuart Moore

Musings of a Data professional

Stuart Moore

Month: December 2013

Handling striped SQL Server backupsets using PowerShell

PowerShellA quick question on twitter from William Durkin (b|t) reminded me that I hadn’t covered SQL Server multistriped backupsets during my 31 Days of SQL Server Backups and Restores with PowerShell series, so without further ado I’m going to correct that:

Read More

Finding used drive letters on a Microsoft Windows Cluster using PowerShell

PowerShell

Just a quicky this time.

I was called in to install a SQL Server instance on an already built and populated Windows Cluster. Unfortunately as the system had grown, noone had kept an accurate record of which drive letters had been used. So a quick drop into PowerShell and the fun of WMI (as there isn’t a native PowerShell way to get this, yet), and I had this little one liner

Get-WmiObject -Namespace root\MSCluster MSCluster_DiskPartition -ComputerName "Cluster.contoso.com" -Authentication PacketPrivacy `
    | Format-List Path, VolumeLabel

(In this case ComputerName is the cluster name)

And I had a nice list of all the Drives attached to the cluster with their Path and Volume Label. This also returns all the mountpoint mounted volumes as well, which may cloud things on a complex setup. These can be filtered out quite easily, and the list ordered to make it easier to spot the gaps like so:

Get-WmiObject -Namespace root\MSCluster MSCluster_DiskPartition -ComputerName "Cluster.contoso.com" -Authentication PacketPrivacy `
    | Format-List Path, VolumeLabel `
    | Where-Object {$_.Path -like "?:"} `
    | Sort-Object $_.Path
    | Format-List Path, VolumeLabel

While this is really handy, it’s still no real substitute for properly documenting your cluster while it’s being built. Please for your own sanity, and mine if  I ever get called out to it, document all your drives, saves relying on random PowerShell scripts you find lying around on the Internet!

Powered by WordPress & Theme by Anders Norén