Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Install SQL Server 2014
- # Source: https://msdn.microsoft.com/en-us/library/hh231669.aspx
- 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
- # Enable remote connections on the instance of SQL Server
- EXEC sys.sp_configure N'remote access', N'1'
- GO
- RECONFIGURE WITH OVERRIDE
- GO
- # Enable and start the SQL Server Browser service
- sc config SQLBROWSER start= auto
- # After it is enabled, run the following command from the command prompt to start the service:
- net start SQLBROWSER
- # Create exceptions in Windows Firewall
- netsh firewall set portopening protocol = TCP port = 1433 name = SQLPort mode = ENABLE scope = SUBNET profile = CURRENT
- # Enable TCP/IP on the instance of SQL Server
- $smo = 'Microsoft.SqlServer.Management.Smo.'
- $wmi = new-object ($smo + 'Wmi.ManagedComputer')
- # Enable the TCP protocol on the default instance. If the instance is named, replace MSSQLSERVER with the instance name in the following line.
- $uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Tcp']"
- $Tcp = $wmi.GetSmoObject($uri)
- $Tcp.IsEnabled = $true
- $Tcp.Alter()
- $Tcp
Advertisement
Add Comment
Please, Sign In to add comment