如何使用powershell删除IIS中选定的应用程序池
我使用以下注释删除单个web应用程序池:如何使用powershell删除IIS中选定的应用程序池,powershell,iis,Powershell,Iis,我使用以下注释删除单个web应用程序池: Remove-WebAppPool Apppool1 但我想删除多个选定的应用程序池。我尝试了以下方法,但无效: Remove-WebAppPool Apppool1,Apppool2 您可以尝试使用以下Powershell脚本: #Set New line using OFS special Powershell variable $OFS = "`n" #Externally set input value as string [string[]
Remove-WebAppPool Apppool1
但我想删除多个选定的应用程序池。我尝试了以下方法,但无效:
Remove-WebAppPool Apppool1,Apppool2
您可以尝试使用以下Powershell脚本:
#Set New line using OFS special Powershell variable
$OFS = "`n"
#Externally set input value as string
[string[]] $_ServerList= @()
#Get the input from the user
$_ServerList = READ-HOST "Enter List of Servers"
#splitting the list of input as array by Comma & Empty Space
$_ServerList = $_ServerList.Split(',').Split(' ')
ForEach ($ApplicationPool in $_ServerList)
{
Remove-WebAppPool $ApplicationPool
}
由于
-Name
不支持名称数组,您需要循环使用它们-->'Apppool1','Apppool2'| Foreach Object{Remove WebAppPool-Name$}
您的问题解决了吗?如果您的问题解决了,请您将有用的建议标记为答案。这将帮助其他面临同样问题的人。