Installing MS SQLSERVER 2012 with PowerShell in 10 Min


In this resource I will explain Installing MS SQLSERVER 2012 with PowerShell .Till Now you might be aware of Installing MS SQLSERVER 2012 through UI. It may take 2 or 3 hours time to install SQLSEREVR.But now I will explain Unattended MS SQLSERVER 2012 installation with PowerShell script. Using this script we can install MS SQLSERVER 2012 in just 10 min.

First you need to copy all SQL files required for setup into D: drive and name that folder as SQL. For my demo I copied all files into "D:\SQL\Enterprise" folder. After installation you can find a automatically created folder "MSSQLSERVER" in E: DRIVE.
You need to create a folder with name " SQLUpdates " in D: drive for updates.


Please create a new .ps1 file with below script


function IsSQLInstalled
{


$FWcheck = Get-WmiObject win32_Product | Select Name | Where-Object { $_.Name -match "Microsoft SQL Server 2012"}

if (!($FWcheck -eq $null)) { return $true }

}

$ErrorActionPreference = "Stop"
Write-Host "Checking whether SQL Server 2012 installed or not..."
if (IsSQLInstalled)
{
Write-Host "SQL Server 2012 already installed. "

}
else{





cd..
cd..
d:

write-host " Initializing SQL Server SetUp Process. Please wait... "
write-host " Installation of Sql Server started. "
WRITE-HOST "Wait for 15 min . . . "
D:\SQL\Enterprise\X64\setup.exe /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /UpdateEnabled=1 /UpdateSource=D:\SQL\Enterprise\SQLUpdates /features="SQLEngine" "SSMS" /installshareddir="D:\SQL\Enterprise\(X64)" /InstallsharedwowDir="D:\SQL\Enterprise\(X86)" /instancedir="D:\SQL\Enterprise\(X64)" /Instancename=MSSQLSERVER /q /AGTSVCACCOUNT="NT Authority\System" /INSTALLSQLDATADIR="D:\SQL\Enterprise\(X64)" /SQLBACKUPDIR="E:\MSSQLSERVER\BACKUP" /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS /SQLSYSADMINACCOUNTS="Admin" /SQLSVCACCOUNT="NT Authority\System" /SQLTEMPDBDIR="E:\MSSQLSERVER\TEMPDB" /SQLTEMPDBLOGDIR="E:\MSSQLSERVER\LOGS" /SQLUSERDBDIR="E:\MSSQLSERVER\USERDB" /SQLUSERDBLOGDIR="E:\MSSQLSERVER\Logs" /RSSVCACCOUNT="NT AUTHORITY\SYSTEM" /INDICATEPROGRESS /PID="xxxxx-xxxxx-xxxxx-xxxxx-xxxxx" |out-null



write-host "Congrats.Sql server Successfully Installed"

#For more details click on below links
http://matthiasberroth.wordpress.com/2013/10/30/install-a-configuration-manager-2012-r2-in-a-lab-4-install-sql-server-2012-sp1-powershell/ #



}




In above script IsSQLInstalled function used to check whether MS SQLSERVER 2012 installed or not. If MS SQLSERVER 2012 not installed it installs MS SQLSERVER 2012 with given features like Database Engine and SSMS. We can specify any required features in below tag


features="SQLEngine" "SSMS"

for Reporting services we can specify features="SQLEngine" "SSMS" "RS"



That's All. By using above script we can install MS SQLSERVER 2012 in any system in 5 min.

Hope this resource helps you a lot.


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: