Skip to content

Commit

Permalink
Added PreBuild.ps1
Browse files Browse the repository at this point in the history
Pulling NHibernate.SQLAzure specific content from https://github.com/MRCollective/AppVeyorConfig/edit/master/appveyor.yml
  • Loading branch information
robdmoore authored Jul 13, 2020
1 parent 25b30e9 commit 3e56154
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions PreBuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null

$serverName = $env:COMPUTERNAME
$instanceName = 'SQL2019'

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

# Enable TCP/IP
$uri = "ManagedComputer[@Name='$serverName']/ServerInstance[@Name='$instanceName']/ServerProtocol[@Name='Tcp']"
$Tcp = $wmi.GetSmoObject($uri)
$Tcp.IsEnabled = $true
$TCP.alter()

# Enable named pipes
$uri = "ManagedComputer[@Name='$serverName']/ ServerInstance[@Name='$instanceName']/ServerProtocol[@Name='Np']"
$Np = $wmi.GetSmoObject($uri)
$Np.IsEnabled = $true
$Np.Alter()

Set-Service SQLBrowser -StartupType Manual
Start-Service SQLBrowser
Start-Service "MSSQL`$$instanceName"

0 comments on commit 3e56154

Please sign in to comment.