Here is a basic PowerShell script to set desired state configuration (DSC) for a service:
configuration ExampleDSC { node <NodeName> { Service <ServiceName> { Name = "<ServiceDisplayName>" State = "Running" StartupType = "Automatic" } } } # Compile the configuration into a MOF file ExampleDSC -OutputPath .\ExampleDSC # Apply the configuration to the node Start-DscConfiguration -Path .\ExampleDSC -Wait -Verbose
Replace <NodeName> with the name of the server you want to configure, and <ServiceName> and <ServiceDisplayName> with the name of the service you want to manage. The State parameter can be set to either "Running" or "Stopped". The StartupType parameter can be set to either "Automatic", "Manual", or "Disabled".
No comments:
Post a Comment