小编sha*_*ank的帖子

在IIS 8应用程序池中为多个服务器启用自动启动属性

我想在IIS 8应用程序池中为power shell脚本中的多个服务器启用自动启动和启动模式属性.我创建了一个适用于单个服务器的脚本.见下文:-

Import-Module WebAdministration
cd IIS:/AppPools
$ApplicationPools = dir
foreach ($item in $ApplicationPools)
{
 $ApplicationPoolName = $item.Name
 $pool = Get-Item $ApplicationPoolName
 $pool.autoStart = 'false'
 $pool.startmode = 'ondemand'
 $pool | Set-Item
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我编辑多个服务器.我所有的服务器都在域中.

powershell

6
推荐指数
1
解决办法
4655
查看次数

用于在IIS中创建网站的Powershell脚本

有人可以帮助我从power shell创建网站.我在下面写的脚本不起作用.

Import-Module WebAdministration

#navigate to the app pools root
cd IIS:\AppPools\

#check if the app pool exists
if (!(Test-Path $iisAppPoolName -pathType container))
{
    #create the app pool
    $appPool = New-Item $iisAppPoolName
    $appPool | Set-ItemProperty -Name "managedRuntimeVersion" -Value $iisAppPoolDotNetVersion
}

#navigate to the sites root
cd IIS:\Sites\

#check if the site exists
if (Test-Path $iisAppName -pathType container)
{
    return
}

#create the site
$iisApp = New-Item $iisAppName -bindings @{protocol="http";bindingInformation=":80:" + $iisAppName} -physicalPath $directoryPath
$iisApp | Set-ItemProperty -Name "applicationPool" -Value $iisAppPoolName
Run Code Online (Sandbox Code Playgroud)

powershell

-7
推荐指数
1
解决办法
2万
查看次数

标签 统计

powershell ×2