liveBook · Manning

Set method

As explained in 100 SQL Server Mistakes and How to Avoid Them

A set method changes a configuration resource so that it matches its desired state.

A set method changes a configuration resource when its current state differs from the desired state. It normally follows a test method, which checks for drift during each evaluation. section 8.9

Mistake #1: treating configuration management as irrelevant to SQL Server.

  • A recurring DSC check can test whether xp_cmdshell is disabled; when drift is found, the set method disables it instead of leaving the instance out of compliance. section 8.9
  • Use the set method as part of a resource and manifest, rather than as an isolated manual change; this improves consistency, reduces effort, and supports compliance. section 8.9

Applying the desired state

After defining a DSC configuration, apply the compiled resources with Start-DscConfiguration -Path 'C:\dsc\InstallSql' -Verbose. The resource's test method determines whether its set method needs to run. section 8.9

Figure 8.3 Configuration management process

Follow the configuration-management process from state testing through conditional state correction across SQL Server hosts. section 8.9

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Defines resources, test methods, set methods, and manifests, but defers full PowerShell DSC treatment.
Examples
Uses recurring xp_cmdshell checks, DSC resources, compiled configurations, and Start-DscConfiguration application.
What it assumes
Assumes basic configuration-management concepts and teaches the test-set-manifest relationship explicitly.
What you can do after
Operate/configure SQL Server with DSC by applying resources that correct detected configuration drift.
How it connects
Links test methods, resources, manifests, configuration management, PowerShell DSC, compliance, and security.

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.