简体   繁体   中英

How can I change IIS application pool property setProfileEnvironment from Powershell?

How can I set the "setProfileEnvironment" property from Powershell?

The following code is generating error "The property 'setProfileEnvironment' cannot be found on this object. Verify that the property exists and can be set."

$IISServerManager = Get-IISServerManager
$pool = $IISServerManager.ApplicationPools.Add("MyPoolName")
...
$pool.ProcessModel.LoadUserProfile = $true
$pool.ProcessModel.SetProfileEnvironment = $true

@BruceZhang's answer worked, as does this:

Set-ItemProperty ("IIS:\AppPools\MyAppPoolName") -Name processModel.setProfileEnvironment -value "true"

Just make sure, if you are using the code block from the original post, that you commit the changes so the new application pool exists before calling the above command, using:

$IISServerManager.CommitChanges()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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