-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path5.1-SetupServerCore.ps1
30 lines (24 loc) · 1.52 KB
/
5.1-SetupServerCore.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<#
Before running this, you should have a server core machine
built and configured with name and networking.
#>
$pw='vanh0uten!42' | ConvertTo-SecureString -AsPlainText -force
$cred = New-Object System.Management.Automation.PSCredential ('STARFLEET\Administrator',$pw)
Add-Computer -DomainName 'starfleet.com' -Credential $cred -NewName WORF -Restart
#POST SERVER INIT, BASE CONFIGURATION
#configure powershell as default shell
#This is part of my base image, you would need to do this for your own environment
#Write-Warning "Set Powershell as default shell"
#set-itemproperty "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\WinLogon" shell 'powershell.exe -noexit -command "$psversiontable;import-module ServerManager"'
#Install .Net Framework
"Install .Net Libraries"
Add-WindowsFeature NET-Framework-Core -Source D:\sources\sxs
#update firewall
New-NetFirewallRule -DisplayName "Allow SQL Server" -Direction Inbound –LocalPort 1433 -Protocol TCP -Action Allow
#Create SQL Data directories
Write-Host 'Create default database directories'
New-Item -ItemType Directory -Path C:\DBFiles\Data -Force |ft
New-Item -ItemType Directory -Path C:\DBFiles\Log -Force | ft
New-Item -ItemType Directory -Path C:\DBFiles\TempDB -Force | ft
#install SQL Server
E:\setup.exe /CONFIGURATIONFILE='\\PIKE\InstallFiles\2016install.ini' /SQLSVCACCOUNT='STARFLEET\sqlsvc' /SQLSVCPASSWORD='vanh0uten!42' /AGTSVCACCOUNT='STARFLEET\sqlsvc' /AGTSVCPASSWORD='vanh0uten!42' /SAPWD='vanh0uten!42' /IACCEPTSQLSERVERLICENSETERMS