Powershell – SQL Server pre configuration

This script can be used as a pre-configuration script in case if you want to attach a disk and partition it. Later use the partition as SQL Data and Log folder.

Below is the script flow:

1. Creates a log file in C:\temp folder for logging purpose.

2. Checks for the attached disks and checks for RAW partition.

3. Initializes the RAW to GPT.

4. Creates two partitions of equal size, format them to NTFS with drive letters ‘R’ and ‘S’. (Different drive letters can be provided by changing the appropriate variables)

5. Configure the SQL Server, to use, ‘R’ and ‘S’ as Data and Log directory respectively.

6. Validate the SQL Server service status.

Note: Tested and validated on SQL Server 2012

Download the Powershell script: SQL Server pre configuration

Screenshots:

 

R_and_S_folder

 

temp_data_log_folders

 

database_config

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s