简体   繁体   中英

how to remove selected Apppools in IIS with powershell

I am using the following comment to remove a single web application pool:

Remove-WebAppPool Apppool1

But I want to remove multiple selected Apppools. I have tried the following, but it does not work:

Remove-WebAppPool Apppool1,Apppool2

You could try to use the below Powershell script:

#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
}

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM