使用 运行space 到 运行 远程命令时的新项目行为更改
New-Item Behavior Changes When Using Runspace to Run Command Remotely
我正在使用 VB.Net 打开 Powershell 运行space 使用 WSManConnectionInfo
。连接工作正常。我正在尝试 运行 New-Item 命令以创建新的虚拟目录。
New-Item "IIS:\Sites\ExternalInventory FTP\TestVT" -Type VirtualDirectory -physicalPath "C:\"
当 运行在服务器本地运行命令时,该命令工作正常。但是,当通过 运行 空间远程 运行 时,我得到一个错误:
A parameter cannot be found that matches parameter name 'physicalPath'.
我最初尝试使用 New-WebVirtualDirectory
命令来创建虚拟目录,但这导致了其他错误。我需要使用 New-Item
.
是什么导致了 New-Item 命令行为的不同,我如何使用它通过 运行space 创建一个新的虚拟目录?
注意:我已经通过 运行space 尝试了其他命令,它们似乎按预期工作。
编辑
我知道 New-Item 命令没有文档中列出的参数 "physicalPath":https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-item?view=powershell-6
New-Item 命令在文档中的多个位置用于创建带有 physicalPath 参数的虚拟目录。查看链接
正如评论中所指出的,我需要在我的脚本中包含 WebAdministration 模块。
感谢 TheMadTechnitian
我正在使用 VB.Net 打开 Powershell 运行space 使用 WSManConnectionInfo
。连接工作正常。我正在尝试 运行 New-Item 命令以创建新的虚拟目录。
New-Item "IIS:\Sites\ExternalInventory FTP\TestVT" -Type VirtualDirectory -physicalPath "C:\"
当 运行在服务器本地运行命令时,该命令工作正常。但是,当通过 运行 空间远程 运行 时,我得到一个错误:
A parameter cannot be found that matches parameter name 'physicalPath'.
我最初尝试使用 New-WebVirtualDirectory
命令来创建虚拟目录,但这导致了其他错误。我需要使用 New-Item
.
是什么导致了 New-Item 命令行为的不同,我如何使用它通过 运行space 创建一个新的虚拟目录?
注意:我已经通过 运行space 尝试了其他命令,它们似乎按预期工作。
编辑
我知道 New-Item 命令没有文档中列出的参数 "physicalPath":https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-item?view=powershell-6
New-Item 命令在文档中的多个位置用于创建带有 physicalPath 参数的虚拟目录。查看链接
正如评论中所指出的,我需要在我的脚本中包含 WebAdministration 模块。
感谢 TheMadTechnitian