简体   繁体   English

IIS Recycling Powershell部署; 代码不更改设置

[英]IIS Recycling Powershell Deploy; Code Not Changing Settings

So I'm wondering what's going on. 所以我想知道发生了什么。 The code doesn't report any errors and all signs point to success, but the "Virtual Memory Limit" doesn't seem to change and the 代码不报告任何错误,所有迹象都指向成功,但“虚拟内存限制”似乎没有改变和

"Get-itemProperty" for Recycling.periodicRestart.Memory also doesn't seem to change it's value. Recycling.periodicRestart.Memory的“Get-itemProperty”似乎也没有改变它的价值。

I'm executing this on a domain admin. 我正在域管理员上执行此操作。 It can change recycling.periodicRestart.schedule.collection no problem using the same script. 它可以改变recycle.periodicRestart.schedule.collection使用相同的脚本没问题。

Anyway, here's the script, do you see any reason why that wouldn't be working? 无论如何,这是脚本,你看到为什么那不起作用的原因?

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

Here is the script that WORKS to set the value of PeriodicRestart.Schedule.Collection 这是用于设置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 could use below command to recycle an application based on Virtual Memory Limit: 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

在此输入图像描述

Regards, Jalpa 此致,Jalpa

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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