Удалить po0ls
#Deleting Sites and app pools in IIS 7 with PowerShell
$appCmd = "C:\windows\system32\inetsrv\appcmd.exe"
#lists all the sites
#& $appcmd list site
#deletes a specific site
#& $appcmd delete site "Name of site"
#lists all the sites
#& $appcmd list apppool
#deletes a specific application pool
#& $appcmd delete apppool "Name of app pool"
#delete any app pools that use a certain username (in the identity column of the GUI)
#$account = "TheDomain\TheAccount"
$AppPools = & $appcmd list apppool
foreach ($pool in $AppPools){
$pool = $pool.split(" ")[1] #get the name only
& $appcmd delete apppool $pool
}
#delete all app pools that use a certain username except for a given app pool name
$account = "TheDomain\TheAccount"
$AppPools = & $appcmd list apppool /processModel.userName:$account
foreach ($pool in $AppPools){
$pool = $pool.split(" ")[1] #get the name only
if ($pool -ne "MyAppPool")
{
& $appcmd delete apppool $pool
}
}
Удалить site
#Deleting Sites and app pools in IIS 7 with PowerShell
$appCmd = "C:\windows\system32\inetsrv\appcmd.exe"
#lists all the sites
& $appcmd list site
#deletes a specific site
#& $appcmd delete site "Name of site"
#deletes a specific application pool
#& $appcmd delete apppool "Name of app pool"
#delete any app pools that use a certain username (in the identity column of the GUI)
#$account = "TheDomain\TheAccount"
$AppPools = & $appcmd list site # /processModel.userName:$account
foreach ($pool in $AppPools){
$pool = $pool.split(" ")[1] #get the name only
& $appcmd delete site $pool
}
#delete all app pools that use a certain username except for a given app pool name
#$account = "TheDomain\TheAccount"
$AppPools = & $appcmd list site #/processModel.userName:$account
foreach ($pool in $AppPools){
$pool = $pool.split(" ")[1] #get the name only
if ($pool -ne "MyAppPool")
{
& $appcmd delete site $pool
}
}
Similar Posts:
- Как перенести пулы и сайты с iis с одного сервера на другой.
- Как остановить и запустить все пулы iis через Powershell
- Как обновить сертификат ssl hp ilo через PowerShell и Windows CA
- Как исправить ошибку в VMware Horizon при создании мгновенных клонов(instant clone).
- Как поменять сертификаты на iis для всех сайтов с помощью powershell.