Repository navigation
Conversation
Adds Enable- and Disable-ServiceControlMaintenanceMode and the audit equivalents, with sc-maintenance-on/off and audit-maintenance-on/off aliases. Each cmdlet stops the service, updates the maintenance mode setting, and starts the service.
Start- stops the service, enables maintenance mode, and starts the service. Stop- stops the service and clears maintenance mode, leaving the service stopped, as ServiceControl Management does. Aliases become sc-maintenance-start/stop and audit-maintenance-start/stop.
Each cmdlet now lives in the ServiceControlInstances or AuditInstances folder and carries its own parameter, admin check, and instance lookup.
| New-Alias -Value Start-ServiceControlMaintenanceMode -Name sc-maintenance-start | ||
| New-Alias -Value Stop-ServiceControlMaintenanceMode -Name sc-maintenance-stop | ||
| New-Alias -Value Start-ServiceControlAuditMaintenanceMode -Name audit-maintenance-start | ||
| New-Alias -Value Stop-ServiceControlAuditMaintenanceMode -Name audit-maintenance-stop |
There was a problem hiding this comment.
| New-Alias -Value Start-ServiceControlMaintenanceMode -Name sc-maintenance-start | |
| New-Alias -Value Stop-ServiceControlMaintenanceMode -Name sc-maintenance-stop | |
| New-Alias -Value Start-ServiceControlAuditMaintenanceMode -Name audit-maintenance-start | |
| New-Alias -Value Stop-ServiceControlAuditMaintenanceMode -Name audit-maintenance-stop | |
| New-Alias -Value Start-ServiceControlMaintenanceMode -Name sc-startmaintenance | |
| New-Alias -Value Stop-ServiceControlMaintenanceMode -Name sc-stopmaintenance | |
| New-Alias -Value Start-ServiceControlAuditMaintenanceMode -Name audit-startmaintenance | |
| New-Alias -Value Stop-ServiceControlAuditMaintenanceMode -Name audit-stopmaintenance |
There was a problem hiding this comment.
I wonder whether mode even adds any value to the full command name. We do have docs that say Maintenance Mode, and the UI says maintenance mode, but it's just extra letters to potentially type in this scenario, and we removed it from the aliases. Either way is probably fine; it's just something to consider the trade-offs of.
| <dev:version /> | ||
| </command:details> | ||
| <maml:description> | ||
| <maml:para>Stops the ServiceControl service and removes the maintenance mode setting from its configuration file. The service stays stopped; start it normally to resume ingesting error messages. Requires an elevated session. Alias: sc-maintenance-stop</maml:para> |
There was a problem hiding this comment.
| <maml:para>Stops the ServiceControl service and removes the maintenance mode setting from its configuration file. The service stays stopped; start it normally to resume ingesting error messages. Requires an elevated session. Alias: sc-maintenance-stop</maml:para> | |
| <maml:para>Stops the ServiceControl service and removes the maintenance mode setting from its configuration file. The service stays stopped; start it normally to resume ingesting error messages. Requires an elevated session. Alias: sc-stopmaintenance</maml:para> |
| <dev:version /> | ||
| </command:details> | ||
| <maml:description> | ||
| <maml:para>Stops the ServiceControl service, writes the maintenance mode setting to its configuration file, and starts the service again. In maintenance mode the instance does not ingest error messages and its RavenDB database stays available. Run Stop-ServiceControlMaintenanceMode to clear the setting and stop the service. Requires an elevated session. Alias: sc-maintenance-start</maml:para> |
There was a problem hiding this comment.
| <maml:para>Stops the ServiceControl service, writes the maintenance mode setting to its configuration file, and starts the service again. In maintenance mode the instance does not ingest error messages and its RavenDB database stays available. Run Stop-ServiceControlMaintenanceMode to clear the setting and stop the service. Requires an elevated session. Alias: sc-maintenance-start</maml:para> | |
| <maml:para>Stops the ServiceControl service, writes the maintenance mode setting to its configuration file, and starts the service again. In maintenance mode the instance does not ingest error messages and its RavenDB database stays available. Run Stop-ServiceControlMaintenanceMode to clear the setting and stop the service. Requires an elevated session. Alias: sc-startmaintenance</maml:para> |
| { | ||
| [ValidateNotNullOrEmpty] | ||
| [Parameter(Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, Position = 0, HelpMessage = "Specify the ServiceControl Audit instance name")] | ||
| public string[] Name { get; set; } |
There was a problem hiding this comment.
This can probably just be a single string and not an array
|
|
||
| protected override void ProcessRecord() | ||
| { | ||
| foreach (var name in Name) |
There was a problem hiding this comment.
this foreach can go away
| </maml:description> | ||
| <command:parameterValue required="true" variableLength="true">String[]</command:parameterValue> | ||
| <dev:type> | ||
| <maml:name>String[]</maml:name> |
There was a problem hiding this comment.
| <maml:name>String[]</maml:name> | |
| <maml:name>String</maml:name> |
| <maml:description> | ||
| <maml:para>Name of the ServiceControl Audit Service. This corresponds to the Windows Service Name for the service not the Display Name.</maml:para> | ||
| </maml:description> | ||
| <command:parameterValue required="true" variableLength="true">String[]</command:parameterValue> |
There was a problem hiding this comment.
| <command:parameterValue required="true" variableLength="true">String[]</command:parameterValue> | |
| <command:parameterValue required="true" variableLength="true">String</command:parameterValue> |
| </maml:description> | ||
| <command:parameterValue required="true" variableLength="true">String[]</command:parameterValue> | ||
| <dev:type> | ||
| <maml:name>String[]</maml:name> |
There was a problem hiding this comment.
| <maml:name>String[]</maml:name> | |
| <maml:name>String</maml:name> |
| </maml:description> | ||
| <command:parameterValue required="true" variableLength="true">String[]</command:parameterValue> | ||
| <dev:type> | ||
| <maml:name>String[]</maml:name> |
There was a problem hiding this comment.
| <maml:name>String[]</maml:name> | |
| <maml:name>String</maml:name> |
| <maml:description> | ||
| <maml:para>Name of the ServiceControl Service. This corresponds to the Windows Service Name for the service not the Display Name.</maml:para> | ||
| </maml:description> | ||
| <command:parameterValue required="true" variableLength="true">String[]</command:parameterValue> |
There was a problem hiding this comment.
| <command:parameterValue required="true" variableLength="true">String[]</command:parameterValue> | |
| <command:parameterValue required="true" variableLength="true">String</command:parameterValue> |
Draft pr. I will add detail if testing works out.