且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在PowerShell中使用Web管理模块设置应用程序池的应用程序标识?

更新时间:2022-12-20 20:23:05

导入时Web管理模块, PowerShell 构建一个名为 IIS 的驱动器。此驱动器允许您像管理文件系统一样管理 IIS ,只需使用 IIS:而不是 C:来表示驱动器。

When you import the WebAdministration module, PowerShell builds a drive called IIS. This drive allows you to manage IIS just like you would via the file system by simply using IIS: instead of C: to represent the drive.

你可以像这样创建一个游泳池:

You can create a Pool like:

    New-Item IIS:\AppPools\$AppPool
    $NewPool = Get-Item IIS:\AppPools\$AppPool
    $NewPool.ProcessModel.Username = "$Username"
    $NewPool.ProcessModel.Password = "$Password"
    $NewPool.ProcessModel.IdentityType = 2
    $NewPool | Set-Item

因此,要使用以下命令,您必须使用WebAdministration模块:

So for using the below command you have to use the WebAdministration module:

Set-ItemProperty IIS:\AppPools\NewAppPool -name processModel.identityType -value 2

希望有所帮助。