本文介绍了使用Powershell所需的配置状态的App Pool高级设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Powershell在新的或现有的应用程序池中修改各种设置?

How can I modify various settings inside either a new or exisitng App Pool using Powershell?

我对某些高级"设置很感兴趣,例如启用32位应用程序",托管管道模式",过程模型标识"等.关于如何执行此操作的任何想法?我尝试使用xWebAdministration模块,但这似乎具有非常基本的设置.

I am interesting in some of the "Advanced" settings such as Enable 32-Bit Applications, Managed Pipeline Mode, Process Model Identity, etc. Any ideas on how I can do this? I tried using the xWebAdministration module but that seems to have very basic settings.

推荐答案

是的,自定义DSC资源是使用DSC进行此操作的唯一方法.如果能够在没有DSC的情况下使用PowerShell脚本,则可以使用 WebAdministration模块模块来创建池,然后从那里对其进行修改.

Yes, a custom DSC resource is the only way to do this with DSC. If you are able to use PowerShell scripting without DSC, you can use the WebAdministration module module to create the pool, and then modify it from there.

$appPoolName = "MyAppPool"
New-WebAppPool -Name $appPoolName
$appPool = Get-Item "IIS:\AppPools\$appPoolName"
$appPool.processModel.identityType = 3
$appPool.processModel.username = "someUser"
$appPool.processModel.password = "somePassword"
$appPool.managedRuntimeVersion = "v4.0"
$appPool.managedPipeLineMode = "Integrated"

更新1/31/2015

在PowerShell.org社区DSC模块中,有人提出了cWebAdministration 拉动请求,其中显然包括"37 app池配置选项".可能是一个很好的解决方案.

In the PowerShell.org community DSC modules, someone made a cWebAdministration pull request that apparently includes "37 app pool config options". Might be a great solution.

这篇关于使用Powershell所需的配置状态的App Pool高级设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 16:32