使用 PowerShell 配置 IIS 应用程序池设置

Kra*_*ank 2 iis powershell

我尝试使用 PowerShell 通过运行以下 Cmdlet 将 IIS 应用程序池的 Enable32BitApplication 和 LoadUserProfile 的值设置为 True:

(Get-IISAppPool -Name DefaultAppPool).enable32BitAppOnWin64 = $True
(Get-IISAppPool -Name DefaultAppPool).ProcessModel.LoadUserProfile = $True
Run Code Online (Sandbox Code Playgroud)

当我使用 PowerShell 检索这些值时,Cmdlet 看起来似乎已成功运行,但当我尝试在 GUI 中检查它时,我发现它不起作用。这就是为什么我尝试测试应用程序池网站的运行情况,但我发现这些 Cmdlet 不起作用。谁能帮助我使用正确的 PowerShell Cmdlet?

小智 7

为了使其通过修改返回的对象来工作,Get-IISAppPool您必须Start-IISCommitDelay在更改值之前调用,然后Stop-IISCommitDelay在进行更改之后调用。所以在你的情况下它是:

Start-IISCommitDelay
(Get-IISAppPool -Name DefaultAppPool).enable32BitAppOnWin64 = $True
(Get-IISAppPool -Name DefaultAppPool).ProcessModel.LoadUserProfile = $True
Stop-IISCommitDelay
Run Code Online (Sandbox Code Playgroud)