Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion private/functions/Update-ServiceStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ process {
$target = "$($_.Service.ServiceName) on $($_.Service.ComputerName)"
Write-Message -Level Warning -Message "($target) $($_.Service.Message)" -Target $target
if ($_.Service.ServiceType -eq 'Engine' -and $_.ServiceExitCode -eq 3) {
Write-Message -Level Warning -Message "($target) Run the command with '-Force' switch to force the restart of a dependent SQL Agent" -Target $target
Write-Message -Level Warning -Message "($target) Run the command with '-Force' switch to force the restart of dependent services (SQL Agent, PolyBase)" -Target $target
}
}
$_.Service | Select-DefaultView -Property ComputerName, ServiceName, InstanceName, ServiceType, State, Status, Message
Expand Down
6 changes: 3 additions & 3 deletions public/Start-DbaService.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Start-DbaService {
Starts SQL Server related services across multiple computers while respecting service dependencies.

.DESCRIPTION
Starts SQL Server services (Engine, Agent, Browser, FullText, SSAS, SSIS, SSRS) on one or more computers following proper dependency order. This function handles the complexity of starting services in the correct sequence so you don't have to manually determine which services depend on others. Commonly used after maintenance windows, server reboots, or when troubleshooting stopped services across an environment.
Starts SQL Server services (Engine, Agent, Browser, FullText, SSAS, SSIS, SSRS, PolyBase, Launchpad) on one or more computers following proper dependency order. This function handles the complexity of starting services in the correct sequence so you don't have to manually determine which services depend on others. Commonly used after maintenance windows, server reboots, or when troubleshooting stopped services across an environment.

Requires Local Admin rights on destination computer(s).

Expand All @@ -25,7 +25,7 @@ function Start-DbaService {
Credential object used to connect to the computer as a different user.

.PARAMETER Type
Filters to specific SQL Server service types rather than starting all services. Valid types: Agent, Browser, Engine, FullText, SSAS, SSIS, SSRS.
Filters to specific SQL Server service types rather than starting all services. Valid types: Agent, Browser, Engine, FullText, SSAS, SSIS, SSRS, PolyBase, Launchpad.
Use this when you need to start only specific service types, such as starting just SQL Agent after maintenance or only SSRS services on reporting servers.

.PARAMETER Timeout
Expand Down Expand Up @@ -90,7 +90,7 @@ function Start-DbaService {
[string[]]$InstanceName,
[Parameter(ParameterSetName = "Server")]
[DbaInstanceParameter[]]$SqlInstance,
[ValidateSet("Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS")]
[ValidateSet("Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS", "PolyBase", "Launchpad")]
[string[]]$Type,
[parameter(ValueFromPipeline, Mandatory, ParameterSetName = "Service")]
[Alias("ServiceCollection")]
Expand Down
30 changes: 18 additions & 12 deletions public/Stop-DbaService.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Stop-DbaService {
Stops SQL Server-related Windows services with proper dependency handling.

.DESCRIPTION
Stops SQL Server services including Database Engine, SQL Agent, Reporting Services, Analysis Services, Integration Services, and other components across one or more computers. Automatically handles service dependencies to prevent dependency conflicts during shutdown operations.
Stops SQL Server services including Database Engine, SQL Agent, Reporting Services, Analysis Services, Integration Services, PolyBase, Launchpad, and other components across one or more computers. Automatically handles service dependencies to prevent dependency conflicts during shutdown operations.

Particularly useful for planned maintenance windows, troubleshooting service issues, or preparing servers for patching and reboots. The Force parameter allows stopping dependent services automatically, which is essential when stopping Database Engine services that have SQL Agent dependencies.

Expand All @@ -29,7 +29,7 @@ function Stop-DbaService {
Credential object used to connect to the computer as a different user.

.PARAMETER Type
Filters which SQL Server service types to stop. Valid options: Agent, Browser, Engine, FullText, SSAS, SSIS, SSRS.
Filters which SQL Server service types to stop. Valid options: Agent, Browser, Engine, FullText, SSAS, SSIS, SSRS, PolyBase, Launchpad.
Use this when you need to stop specific service types across instances, such as stopping all SQL Agent services for patching while keeping Database Engine services running.

.PARAMETER Timeout
Expand Down Expand Up @@ -103,7 +103,7 @@ function Stop-DbaService {
[string[]]$InstanceName,
[Parameter(ParameterSetName = "Server")]
[DbaInstanceParameter[]]$SqlInstance,
[ValidateSet("Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS")]
[ValidateSet("Agent", "Browser", "Engine", "FullText", "SSAS", "SSIS", "SSRS", "PolyBase", "Launchpad")]
[string[]]$Type,
[parameter(ValueFromPipeline, Mandatory, ParameterSetName = "Service")]
[Alias("ServiceCollection")]
Expand Down Expand Up @@ -133,16 +133,22 @@ function Stop-DbaService {
end {
$processArray = [array]($processArray | Where-Object { (!$InstanceName -or $_.InstanceName -in $InstanceName) -and (!$Type -or $_.ServiceType -in $Type) })
foreach ($service in $processArray) {
if ($Force -and $service.ServiceType -eq 'Engine' -and !($processArray | Where-Object { $_.ServiceType -eq 'Agent' -and $_.InstanceName -eq $service.InstanceName -and $_.ComputerName -eq $service.ComputerName })) {
#Construct parameters to call Get-DbaService
$serviceParams = @{
ComputerName = $service.ComputerName
InstanceName = $service.InstanceName
Type = 'Agent'
if ($Force -and $service.ServiceType -eq 'Engine') {
# Add dependent services (Agent, PolyBase) if not already in the array
$dependentTypes = @('Agent', 'PolyBase')
foreach ($depType in $dependentTypes) {
if (!($processArray | Where-Object { $_.ServiceType -eq $depType -and $_.InstanceName -eq $service.InstanceName -and $_.ComputerName -eq $service.ComputerName })) {
#Construct parameters to call Get-DbaService
$serviceParams = @{
ComputerName = $service.ComputerName
InstanceName = $service.InstanceName
Type = $depType
}
if ($Credential) { $serviceParams.Credential = $Credential }
if ($EnableException) { $serviceParams.EnableException = $EnableException }
$processArray += @(Get-DbaService @serviceParams)
}
}
if ($Credential) { $serviceParams.Credential = $Credential }
if ($EnableException) { $serviceParams.EnableException = $EnableException }
$processArray += @(Get-DbaService @serviceParams)
}
}
if ($PSCmdlet.ShouldProcess("$ProcessArray", "Stopping Service")) {
Expand Down