henrydenhengst

Install SQL Server 2014

May 9th, 2015
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Install SQL Server 2014
  2. # Source: https://msdn.microsoft.com/en-us/library/hh231669.aspx
  3. Setup.exe /qs /ACTION=Install /FEATURES=SQLEngine,Replication /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="<DomainName\UserName>" /SQLSVCPASSWORD="<StrongPassword>" /SQLSYSADMINACCOUNTS="<DomainName\UserName>" /AGTSVCACCOUNT="NT AUTHORITY\Network Service" /TCPENABLED=1 /IACCEPTSQLSERVERLICENSETERMS
  4.  
  5. # Enable remote connections on the instance of SQL Server
  6. EXEC sys.sp_configure N'remote access', N'1'
  7. GO
  8. RECONFIGURE WITH OVERRIDE
  9. GO
  10.  
  11. # Enable and start the SQL Server Browser service
  12. sc config SQLBROWSER start= auto
  13. # After it is enabled, run the following command from the command prompt to start the service:
  14. net start SQLBROWSER
  15.  
  16. # Create exceptions in Windows Firewall
  17. netsh firewall set portopening protocol = TCP port = 1433 name = SQLPort mode = ENABLE scope = SUBNET profile = CURRENT
  18.  
  19. # Enable TCP/IP on the instance of SQL Server
  20. $smo = 'Microsoft.SqlServer.Management.Smo.'
  21. $wmi = new-object ($smo + 'Wmi.ManagedComputer')
  22.  
  23. # Enable the TCP protocol on the default instance.  If the instance is named, replace MSSQLSERVER with the instance name in the following line.
  24. $uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Tcp']"
  25. $Tcp = $wmi.GetSmoObject($uri)
  26. $Tcp.IsEnabled = $true
  27. $Tcp.Alter()
  28. $Tcp
Advertisement
Add Comment
Please, Sign In to add comment