2019-02-27

Install SQL on Server Core

先用 Standard / Enterprise 版產生 ConfigurationFile.INI
*. Express 版本安裝 GUI 沒有一個 (Ready to Install 的步驟可以停下來產生 .ini 檔)
取得 ConfigurationFile.INI 後進行以下變更



Edit: IACCEPTPYTHONLICENSETERMS="True"
Add: IAcceptSQLServerLicenseTerms="True"
Edit: IACCEPTROPENLICENSETERMS="True"
Edit: QUIETSIMPLE="True"
Edit: TCPENABLED="1"
Edit: NPENABLED="1"
Mark: UIMode="Normal" (在前面加 ; 或是直接刪除該項目)

若帳號是 Mixed Mode
在 SECURITYMODE="SQL" 的下一行設定 sa 的密碼
Add: SAPWD="P@$$w0rd"

完成修改後執行安裝:
Setup.exe /ConfigurationFile=MyConfigurationFile.INI


sqlps.exe


$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = new-object ($smo + 'Wmi.ManagedComputer')
$instance = 'SQLEXPRESS'

# List the object properties, including the instance names.
$Wmi

# Enable the TCP protocol on the default instance.
$uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ ServerInstance[@Name='" + $instance + "']/ServerProtocol[@Name='Tcp']"
$Tcp = $wmi.GetSmoObject($uri)
$Tcp.IsEnabled = $true
$Tcp.Alter()
$Tcp

# Enable the named pipes protocol for the default instance.
$uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ ServerInstance[@Name='" + $instance + "']/ServerProtocol[@Name='Np']"
$Np = $wmi.GetSmoObject($uri)
$Np.IsEnabled = $true
$Np.Alter()
$Np



以上都做完了還是不能 Remote Management
甚至連 1433 Port 也沒 Listen,不知啥問題,放棄,還是裝 GUI

沒有留言:

張貼留言