After SQL server is installed (and depending on your need), it needs the protocols enabled. I enable TCP and Named Pipes.
Import-Module Servermanager
function ChangeSQLProtocolStatus($server,$instance,$protocol,$enable){
$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = new-object ($smo + 'Wmi.ManagedComputer')
$singleWmi = $wmi | where {$_.Name -eq $server}
$uri = "ManagedComputer[@Name='$server']/ServerInstance[@Name='$instance']/ServerProtocol[@Name='$protocol']"
$protocol = $singleWmi.GetSmoObject($uri)
$protocol.IsEnabled = $enable
$protocol.Alter()
$protocol
}
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement")
#or else sharepoint won't install
ChangeSQLProtocolStatus -server $env:COMPUTERNAME -instance "SP2013" -protocol "TCP" -enable $true
#or else sharepoint won't install
ChangeSQLProtocolStatus -server $env:COMPUTERNAME -instance "SP2013" -protocol "NP" -enable $true
No comments:
Post a Comment