powershell - 使用 powershell 启动/停止 IIS 网站时的权限

标签 powershell iis permissions

我有一个 WCF 服务,它运行 PS 命令以在本地计算机和远程计算机上启动 IIS 网站。命令是:

$siteName = '" + siteName + "';
$serverName = '" + serverName + "';
$block = {" + block + "};
$session = New-PSSession -ComputerName $serverName
Invoke-Command -Session $session -ScriptBlock $block -ArgumentList $siteName

要使此命令起作用,我们需要将运行 WCF 服务的应用程序池帐户添加到托管网站的计算机上的管理员组。

有没有办法在不授予应用程序池帐户管理员访问权限的情况下实现这一目标?

问候,
希尔帕

最佳答案

好吧,经过一些快速检查后,我发现了这个,

To use the Windows PowerShell cmdlets for IIS, you must be a member of the IIS Administrators or Administrators group, or you must have been delegated the appropriate authority.



这是来自 Misrosoft 网站上的 Powershell CMDLETS 管理工具,Here

所以看起来您可以成为 IIS 管理员的成员并获得相同的能力。

更新:

如果您希望其他人能够运行 Powershell,您需要执行以下操作;
Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI

并确认您要执行该操作,这会弹出以下对话框,允许您让其他人能够在该机器上运行命令:
Image

我从 Microsoft 找到了这个如果这能解决您的问题,请告诉我。

关于powershell - 使用 powershell 启动/停止 IIS 网站时的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31455565/

相关文章:

azure - 我需要在 web.config 中的 ApplicationInitialization 添加端口吗

asp.net - "There was an error while performing this operation"

android - 如何请求权限 : READ_PRIVILEGED_PHONE_STATE?

php - 无法在php中打开文件

powershell - 我们可以不拥有域管理员的权限而访问具有特定权限的域中的所有服务器吗?

powershell - 按属性名称过滤 cim 实例类

powershell - Get-ADUser 过滤掉特定 OU、自定义列

windows - 在 IIS 上删除 Codeigniter 的 index.php?

sql - 如何将 Snowflake 中的 PROCEDURE_DEFINITION 访问权限从 ADMIN 角色授予另一个角色?

powershell - PowerShell 模块中是否存在检查函数