25 lines
726 B
PowerShell
25 lines
726 B
PowerShell
|
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"
|
||
|
}
|
||
|
}
|