使用WebAdministration从.net运行Powershell脚本

本文关键字:Powershell 脚本 运行 net WebAdministration 使用 | 更新日期: 2023-09-27 18:13:49

我正在编写一个小型web应用程序,它将在本地主机上运行一些powershell脚本来创建新的IIS站点等。我的脚本在ISE 64位运行良好,但当试图在32位运行它们时,我得到的错误如下:

Get-ChildItem IIS:'Sites
Get-ChildItem : Cannot retrieve the dynamic parameters for the cmdlet. Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154.

我已经尝试下载x86版本的管理单元,但安装程序停止告诉我使用"程序和功能"来安装它,我已经尝试过了,但找不到应该启用的未启用的内容。

这是一个问题,因为。net应用程序似乎在32位powershell中运行脚本,所以我的2个问题是:

  1. 我可以在64位运行这些脚本从。net
  2. 我可以在64位操作系统上安装32位的snap ins吗

使用WebAdministration从.net运行Powershell脚本

PowerShell同时安装32位和64位的WebAdministration模块。在创建运行空间时,是否在尝试使用IIS:驱动器(提供程序)之前执行Import-Module WebAdministration ?