[英]IIS Recycling Powershell Deploy; Code Not Changing Settings
所以我想知道发生了什么。 代码不报告任何错误,所有迹象都指向成功,但“虚拟内存限制”似乎没有改变和
Recycling.periodicRestart.Memory的“Get-itemProperty”似乎也没有改变它的价值。
我正在域管理员上执行此操作。 它可以改变recycle.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
}
}
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
此致,Jalpa
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.