Function Restart-SDKWebClients { <# .SYNOPSIS A function that will restart just the WebClient and WebAdmin IIS processes .DESCRIPTION Does a surgical restart of the WebClient and Admin sites with the option of clearing the temporary ASP.NET files .EXAMPLE Resart-SDKWebClients Resart-SDKWebClients -ClearTemp (Clears Temp ASP.NET files) .NOTES General notes #> [CmdletBinding()] param ( [Parameter(Mandatory=$false)] [switch]$ClearTemp ) $logLead = Get-LogLeadName $appPools = @("WebClientAdmin","Admin","WebClient") ForEach ($appPool in $appPools) { Get-WmiObject -NameSpace 'root\WebAdministration' -class 'WorkerProcess'| Where-Object {$_.AppPoolName -match $appPool} | Select-Object -Expand ProcessId | ForEach-Object { Write-Host "$logLead : Restarting $appPool ..." Stop-Process $_ -force | Out-Null } } if ($ClearTemp) { Remove-DotNetTemporaryFiles } }