通过appcmd.exe设置IIS配置以加载用户配置文件

Ste*_*eve 11 iis powershell appcmd

我试图通过使用appcmd.exe的powershell脚本将"加载用户配置文件"的配置设置为true.阅读了很多文档后,我无法弄清楚正确的语法.

应用程序池的名称就像'accountsmanagement.example.com'我尝试了以下变体,但所有错误都出现了:

c:\Windows\system32\inetsrv\appcmd.exe set config -section:applicationPools /accountsmanagement.example.com.processModel.loadUserProfile:true
Run Code Online (Sandbox Code Playgroud)

如何通过appcmd.exe正确设置加载用户配置文件为true?

小智 15

尝试使用引号.

c:\windows\system32\inetsrv\appcmd.exe set config -section:applicationPools "/[name='accountsmanagement.example.com'].processModel.loadUserProfile:false"
Run Code Online (Sandbox Code Playgroud)


Ric*_*ard 14

如果要纯粹使用PowerShell,可以使用以下PowerShell命令更改应用程序池的"加载用户配置文件"属性.

Import-Module WebAdministration

Set-ItemProperty "IIS:\AppPools\YourAppPoolName" -Name "processModel.loadUserProfile" -Value "False"
Run Code Online (Sandbox Code Playgroud)


小智 8

除了使用appcmd.exe set config您还可以使用以下内容

appcmd.exe set apppool "App Pool name here" -processmodel.loaduserprofile:"true"
Run Code Online (Sandbox Code Playgroud)

要显示可以设置的所有值,请使用

appcmd.exe set apppool "App Pool name here" /?
Run Code Online (Sandbox Code Playgroud)