0

I've been building a script to setup a MSSQL server in PowerShell, but I'm stuck at this point. I can't figure out where the SQL Server Configuration Manager SnapIn is saving the data and I can't figure out how to access it via COM.

Is there a way to change MMC settings (command-line) without having to click through the GUI?

Caleb Jares
  • 6,163
  • 6
  • 56
  • 83
  • What MCC? what settings? – CB. Jun 08 '12 at 18:32
  • SQL Server Configuration Manager. I want to change settings in "SQL Server Network Configuration"/"Protocols for MSSQLSERVER"/"TCP/IP"/"IP Addresses": IP1.TCP Port, IP.Enabled, and IPAll.TCP Port – Caleb Jares Jun 08 '12 at 18:34
  • 1
    You can use SMO, or edit the registry entries. See examples here: http://stackoverflow.com/questions/5033773/how-to-configure-sql-native-client-with-powershell – FilamentUnities Jun 08 '12 at 20:47
  • That did solve it for me. However, I also found a way to create an MMC COM object (`MMC20.Application`). Also, thanks a ton for that link :D That was super helpful! – Caleb Jares Jun 08 '12 at 21:26

1 Answers1

0

Almost all the settings you change in SQL Server are stored in SQL Server somewhere, which means TSQL is used to make those changes. My favorite trick is to run SQL Profiler against a database while changing its settings. You can then see the SQL being used to modify the settings you need, which you can execute from your script. Very useful

Aaron Jensen
  • 25,861
  • 15
  • 82
  • 91