Posted on: 1/14/2015 4:09:23 AM | Views : 817

Hi,
We're trying to write a script that would automatically install a SQL Server Express 2014 (to simplify the deployment of an application).
We've managed to install the software, setup most of the things, but now we are stuck trying to enable the TCP-IP protocol for the named instance that we have created.
Here's the script we're using (took from MSDN):
Import-Module "sqlps" -DisableNamechecking $smo = 'Microsoft.SqlServer.Management.Smo.' $wmi = new-object ($smo + 'Wmi.ManagedComputer'). # List the object properties, including the instance names. $Wmi # Enable the TCP protocol on the default instance. $uri = "ManagedComputer[@Name='JOHN-PC']/ ServerInstance[@Name='DEMO']/ServerProtocol[@Name='Tcp']" $Tcp = $wmi.GetSmoObject($uri) $Tcp.IsEnabled = $false $Tcp.Alter() $Tcp The issue we have is that if we run it in a PowerShell (as administrator), the $Wmi object doesn't have the ...

Go to the complete details ...