簡體   English   中英

IIS Recycling Powershell部署; 代碼不更改設置

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM