使用Powershell创建IIS 6.0应用程序池 [英] Creating an IIS 6.0 Application Pool using Powershell

查看:99
本文介绍了使用Powershell创建IIS 6.0应用程序池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用PowerShell脚本在IIS 6.0上创建应用程序池?

How do I create an Application Pool on IIS 6.0 using a PowerShell script?

这是我到目前为止提出的...

This is what I have come up with so far ...

$appPool = [wmiclass] "root\MicrosoftIISv2:IIsApplicationPool"

谢谢

推荐答案

这不是最明显的过程,但这对我有用.

It isn't the most obvious process, but here is what worked for me..

$AppPoolSettings = [wmiclass]'root\MicrosoftIISv2:IISApplicationPoolSetting'
$NewPool = $AppPoolSettings.CreateInstance()
$NewPool.Name = 'W3SVC/AppPools/MyAppPool'
$Result = $NewPool.Put()

调用Put()可能会出错,但是第二(或第三次)调用应该可以使它工作.这是由于PowerShell V1和WMI出现问题.

You might get an error with the call to Put(), but calling it a second (or third) time should make it work. This is due to an issue with PowerShell V1 and WMI.

这篇关于使用Powershell创建IIS 6.0应用程序池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆