From 3e5615484df2f8abad5d803c91011a4c052d3563 Mon Sep 17 00:00:00 2001 From: Rob Moore Date: Mon, 13 Jul 2020 22:54:32 +0800 Subject: [PATCH] Added PreBuild.ps1 Pulling NHibernate.SQLAzure specific content from https://github.com/MRCollective/AppVeyorConfig/edit/master/appveyor.yml --- PreBuild.ps1 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 PreBuild.ps1 diff --git a/PreBuild.ps1 b/PreBuild.ps1 new file mode 100644 index 0000000..9cdc774 --- /dev/null +++ b/PreBuild.ps1 @@ -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"