This recipe walks through how to change instance configuration settings using PowerShell.
For this recipe, we will:
Change
FillFactor
to 60 percentEnable SQL Server Agent
Set minimum server memory to 500 MB
Change authentication method to
Mixed
Let's change some SQL Server settings using PowerShell:
Open the PowerShell console by going to Start | Accessories | Windows PowerShell | Windows PowerShell ISE.
Import the
SQLPS
module, and create a new SMO Server object:#import SQL Server module Import-Module SQLPS -DisableNameChecking #replace this with your instance name $instanceName = "KERRIGAN" $server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName
Add the following script and run it:
<# run value vs config value config_value," is what the setting has been set to (but may or may not be what SQL Server is actually running now. Some settings don't go into effect until SQL Server...