Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用powershell删除IIS中选定的应用程序池_Powershell_Iis - Fatal编程技术网

如何使用powershell删除IIS中选定的应用程序池

如何使用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[]

我使用以下注释删除单个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[]] $_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$}
您的问题解决了吗?如果您的问题解决了,请您将有用的建议标记为答案。这将帮助其他面临同样问题的人。