49 lines
2.0 KiB
PowerShell
49 lines
2.0 KiB
PowerShell
|
function Stop-IISAndServices {
|
|||
|
<#
|
|||
|
.SYNOPSIS
|
|||
|
Stops both IIS and Windows Services
|
|||
|
|
|||
|
.PARAMETER ExclusionList
|
|||
|
[[-ExclusionList] <string[]>] Array of service names to exclude from being stopped
|
|||
|
#>
|
|||
|
[CmdletBinding()]
|
|||
|
Param(
|
|||
|
[Parameter(Mandatory = $false)]
|
|||
|
[string[]]$exclusionList,
|
|||
|
[Parameter(Mandatory = $false)]
|
|||
|
[switch]$FeaturePassAllSkipSwitchesToGetServicesToStop
|
|||
|
)
|
|||
|
|
|||
|
$logLead = (Get-LogLeadName)
|
|||
|
|
|||
|
Stop-IISOnly
|
|||
|
|
|||
|
Write-Host "$logLead : Sleeping for 5 seconds..."
|
|||
|
Start-Sleep -Seconds 5
|
|||
|
|
|||
|
# We use this to pass-thru switches elsewhere. It's not pretty, but it avoids ugly if-else blocks
|
|||
|
# and does the same thing, now that "if($switchParam)" is the same as "if($switchParam.IsPresent"
|
|||
|
# and both work whether you don't pass them or pass $true/$false.
|
|||
|
#
|
|||
|
# This will - as of 2021-11-04 - only give us the retval of Get-FileBeatsService
|
|||
|
# while still allowing us to Stop-IisOnly AND SMSvcHost AND RazorCore processes
|
|||
|
$services = Get-ServicesToStop `
|
|||
|
-skipSubscriptionService:$FeaturePassAllSkipSwitchesToGetServicesToStop `
|
|||
|
-skipChocolateyServices:$FeaturePassAllSkipSwitchesToGetServicesToStop `
|
|||
|
-skipAlkamiServices:$FeaturePassAllSkipSwitchesToGetServicesToStop
|
|||
|
|
|||
|
if (!(Test-IsCollectionNullOrEmpty -Collection $exclusionList)) {
|
|||
|
Write-Host -Object "$logLead : Number of services to exclude : $($exclusionList.Count)"
|
|||
|
$services = $services | Where-Object { !$exclusionList.Contains($_) }
|
|||
|
}
|
|||
|
|
|||
|
if ($services) {
|
|||
|
Write-Host -Object "$logLead : Number of services to stop in parallel : $($services.count)"
|
|||
|
Stop-ServicesInParallel -ServiceNamestoStop $services
|
|||
|
}
|
|||
|
|
|||
|
Stop-ProcessIfFound -ProcessName "SMSvcHost"
|
|||
|
Stop-ProcessIfFound -ProcessName "Alkami.MicroServices.Notifications.Service.RazorCore"
|
|||
|
# SRE-18110 - Remove this line after DEV-139783 is worked.
|
|||
|
Stop-ProcessIfFound -ProcessName "Alkami.App.Providers.CheckOrders.Harland.CryptlibWrapper.exe"
|
|||
|
}
|