Skip to content

martin9700/Surly.PowerShell.SQL.Tools

Repository files navigation

Surly.PowerShell.SQL.Tools

This is a set of functions I've created for working with our many SQL servers. Does not use PSSQL or SMO, and requires no prerequisites to use. All blindingly fast SQL queries. Includes several functions for getting status of Availability Groups.

INSTRUCTIONS

  1. Download this repo, Unblock the file(s), copy the Surly.PowerShell.SQL.Tools folder to an appropriate module location
  2. Import-Module pathToRepo\Surly.PowerShell.SQL.Tools
  3. Get-Command -Module Surly.PowerShell.SQL.Tools

Functions

  • Invoke-SQLQuery
  • Get-AGCluster
  • Get-AGDatabaseState
  • Get-AGReplicaState
  • Get-ClusterGroupRemote (see below)
  • Get-SQLAuthenticationScheme
  • Get-SQLBackupFileName
  • Get-SQLBackupStatus
  • Get-SQLJobStatus
  • Move-ClusterGroupRemote (see below)
  • New-SQLBackupStatusReport
  • New-SQLJobStatusReport
  • Resize-SQLLogFile
  • Set-AGClusterFailover
  • Set-GroupRowColorsByColumn (see below)

About Move and Get-ClusterGroupRemote

These are not strictly SQL functions, but are designed to failover Windows Failover Cluster Groups (or retrieve data about them) and can be used with any Windows Cluster, not just SQL Availability Groups.

About Set-GroupRowColorsByColumn

This is a HTML enhancement function that will change the CSS class of a background row based on the value of one of the columns. I use it to change the background color whenever the name of a server changes.

Contributing to the Project

Please read the CONTRIBUTING.md file for contributing guidelines

TODO Items

  1. Functionalize New-SQLBackupReport and New-SQLJobsReport
  2. Set-AGClusterFailover fully functional for failover between synchronous nodes. Need to code/test the DR flags and failover to asynchronous nodes.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published