ps/Modules/Alkami.PowerShell.SDK/Public/Start-SDKServices.ps1

48 lines
1.6 KiB
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Start-SDKServices {
<#
.SYNOPSIS
Starts both IIS and Alkami Windows Services
.DESCRIPTION
Starts both IIS and Alkami Windows Services. Max service start parallelism defaults to 10 and can be set by specifying a positive int for the parameter maxParallel.
IIS is started first. Dependent windows services are started next serially, via Start-DependentServices. Remaining Alkami services are started last
.PARAMETER maxParallel
[int] The maximum number of services to start in parallel. Defaults to 10
.EXAMPLE
Start-IISAndServices -maxParallel 2
[Start-IISAndServices] : Service start parallelism set to 2
[Start-IISOnly] : Starting IIS...
[Start-IISOnly] : Done
[Start-IISAndServices] : Sleeping for 5 seconds...
[Start-DependentServices] : No Dependent Services Found to Start
[Get-ChocolateyServices] : Finding services installed out of the chocolatey path.
[Get-ChocolateyServices] : Found 3 chocolatey services.
[Start-IISAndServices] : No Services Found to Start
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)]
[ValidateRange(1, [int]::MaxValue)]
[int]$maxParallel = 10
)
$logLead = Get-LogLeadName
if ($maxParallel -lt 1) {
Write-Host "$logLead : Service start parallelism set to $maxParallel"
}
Write-Host "Restarting redis-master18620 and redis-slave18621"
restart-service @("redis-master18620", "redis-slave18621") -Force
Start-IISOnly
Write-Host "$logLead : Sleeping for 5 seconds..."
Start-Sleep -Seconds 5
Start-ServicesOnly -maxParallel $maxParallel
}