SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

PowerShell to Pre-Create domain objects for SQL Server Cluster

By Fahim Ahmad,

As a DBA, you probably nod dissaprovingly when a vendor or a developer claims they need [sysadmin] priviledges on your SQL Instance in order for their code or product to work.  I have also seen this look on the face of many domain admins (DA) when they are approached by the DBA who claims they need full create, edit, delete, property change rights on the main Computers OU in the corporate Active Directory, because SQL Clustering requires it.  If this is you, brace yourself for a disapproving nod from your DA.

My preferred alternative, one shared by my DA is to create a separate OU in the Active Directlry for all SQL Cluster related objects [ex: SQLCLuster], and let the DA pre-create the computer  objects.  Your only job is to establish all the names you intend to create during the installation of your SQL Cluster.

My personal naming convention for creating Computer Objects to support a SQL Cluster are:

  • SQLPRODc01
  • SQLPRODc01-fs1
  • SQLPRODc01-sql08
  • SQLPRODc01-sql08r2
  • SQLPRODc01-sql12

This script will allow the Domain Admin to create the OU if it does not already exist, and then create the computer object (one per run)  and place it into that OU.  

It is imperative that the new computer object is created as DISABLED (this is taken care of in this script), because when you eventually create the clustered resource in windows, it will look for the unused computer object with a specified name to revive and claim to complete its setup.

It is also crucial that the Domain Admin manually affect the permissions of the created objects.  Once the main cluster computer account (SQLPRODc01$) is created, it needs to be added to the subsequent computer Security tab with FULL CONTROL on all subsequent objects related to that cluster.  I could not elegently script a solution to automate this; any help or enhancements are welcomed.

Total article views: 372 | Views in the last 30 days: 2
Related Articles

PowerShell to search for domain Computer objects

Query Active Directory Computer objects to verify existence


Using computed Columns to Create another Computed Column

Using computed Columns to Create another Computed Column





SQL Server service running under non admin account in cluster environment

Make SQL Server run with non admin account on cluster server.


SQL Server 2005 - Running on Windows 2003 Compute Cluster Server

Runnig SQL Server on Windows 2003 Compute Cluster

active directory    
windows 2008 r2    
windows 2012