ps/Modules/Alkami.PowerShell.IIS/Public/Stop-IISAppPoolByName.ps1

25 lines
726 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Stop-IISAppPoolByName {
<#
.SYNOPSIS
Stops a given IIS App Pool by name
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "", Justification = "We literally want to stop it for automation, of course we are gonna change system state.")]
[CmdletBinding(ConfirmImpact = 'None')]
Param(
[Parameter(Mandatory=$false)]
[Alias("AppPoolName")]
[string]$Name = ""
)
process {
$logLead = (Get-LogLeadName)
Write-Verbose "$logLead : Attempting to stop app pool by name"
if (Test-IISAppPoolByName $Name) {
Stop-WebAppPool -Name $name
}
Write-Verbose "$logLead : Done"
}
}