ps/Modules/Alkami.PowerShell.IIS/Public/Start-IISAndServices.ps1
2023-05-30 22:51:22 -07:00

46 lines
1.5 KiB
PowerShell

function Start-IISAndServices {
<#
.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 -ne 10) {
Write-Host "$logLead : Service start parallelism set to $maxParallel"
}
Start-IISOnly
Write-Host "$logLead : Sleeping for 5 seconds..."
Start-Sleep -Seconds 5
Start-ServicesOnly -maxParallel $maxParallel
}