所以我想知道发生了什么。代码没有报告任何错误,所有标志都指向成功,但“虚拟内存限制”似乎没有更改,并且
Recycling.periodicRestart.Memory的"Get-itemProperty“似乎也没有改变它的值。
我正在域管理员上执行此操作。它可以使用相同的脚本更改recycling.periodicRestart.schedule.collection,没有问题。
不管怎么说,脚本是这样的,你有没有看到任何不起作用的原因?
$Cred = Get-Credential -UserName DOMAIN\admin -Message 'Enter Password'
$servers = @("WEB-SERVER-1","WEB-SERVER-2","WEB-SERVER-3")
foreach ($server in $servers) {
write-host $server
Invoke-Command -ComputerName $server -Credential $cred {
import-module WebAdministration
Set-ItemProperty IIS:\AppPools\* -Name Recycling.periodicRestart.Memory -Value 0
Get-ItemProperty -Path IIS:\AppPools\* -name Recycling.periodicRestart.Memory | fl value
}
}以下是用于设置PeriodicRestart.Schedule.Collection的值的脚本
$Cred = Get-Credential -UserName DOMAIN\admin -Message 'Enter Password'
$servers = @("WEB-SERVER-1","WEB-SERVER-2","WEB-SERVER-3")
foreach ($server in $servers) {
write-host $server
Invoke-Command -ComputerName $server -Credential $cred {
import-module WebAdministration
Set-ItemProperty IIS:\Sites\* -name recycling.periodicRestart.schedule.collection -value @{"01:00:00","12:00:00"}
Get-ItemProperty -Path IIS:\AppPools\* -name recycling.periodicRestart.schedule.collection | fl value
}
}发布于 2019-05-07 11:20:50
Yo可以使用以下命令根据虚拟内存限制回收应用程序:
PS C:\windows\system32> import-module WebAdministration
PS C:\windows\system32> Set-ItemProperty IIS:\AppPools\test -Name Recycling.periodicRestart.memory -Value 11
PS C:\windows\system32> Set-ItemProperty IIS:\AppPools\* -Name Recycling.periodicRestart.memory -Value 11

你好,贾尔帕
https://stackoverflow.com/questions/56014091
复制相似问题