Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 使用运行空间远程运行命令时,新项行为会发生更改_Vb.net_Powershell_Powershell Remoting - Fatal编程技术网

Vb.net 使用运行空间远程运行命令时,新项行为会发生更改

Vb.net 使用运行空间远程运行命令时,新项行为会发生更改,vb.net,powershell,powershell-remoting,Vb.net,Powershell,Powershell Remoting,我正在使用VB.Net使用WSManConnectionInfo打开Powershell运行空间。连接工作正常。我正在尝试运行newitem命令以创建新的虚拟目录 New-Item "IIS:\Sites\ExternalInventory FTP\TestVT" -Type VirtualDirectory -physicalPath "C:\" 在服务器上本地运行该命令时,该命令工作正常。但是,当通过运行空间远程运行时,我得到一个错误: 找不到与参数名称“physicalPath”匹配的

我正在使用VB.Net使用
WSManConnectionInfo
打开Powershell运行空间。连接工作正常。我正在尝试运行newitem命令以创建新的虚拟目录

New-Item "IIS:\Sites\ExternalInventory FTP\TestVT"  -Type VirtualDirectory -physicalPath "C:\"
在服务器上本地运行该命令时,该命令工作正常。但是,当通过运行空间远程运行时,我得到一个错误:

找不到与参数名称“physicalPath”匹配的参数

我最初尝试使用
newwebvirtualdirectory
命令创建虚拟目录,但这导致了其他错误。我需要使用
新项目

是什么导致newitem命令的行为不同,如何使用它通过运行空间创建新的虚拟目录

注意:我已经通过运行空间尝试了其他命令,它们似乎按照预期工作

编辑

我知道newitem命令没有文档中列出的参数“physicalPath”:

newitem命令在文档中的多个位置使用,以使用physicalPath参数创建虚拟目录。参见链接


正如评论中指出的,我需要在脚本中包含WebAdministration模块


谢谢技术> <代码>新项目 >没有<代码> - PhysicalPath < /代码>参数。抱歉,我正在编辑中包括这个。请看我的编辑。还有,为什么命令会在本地使用

-PhysicalPath
参数呢?这是一个指向论坛帖子的链接,这是错误的。我怀疑它在本地工作,因为它使用的是
IIS:
驱动器,对
*-Item
cmdlet的支持取决于您使用的驱动器。而文档链接也错误吗
PS IIS:\Sites>New Item IIS:\Sites\TestSite-bindings@{protocol=“http”;bindingInformation=“:80:TestSite”}-physicalPath c:\test
引用了他们使用该命令的文档:“使用-physicalPath参数非常简单。但是您可能会问自己为什么-bindings参数看起来如此复杂。”我在文档里找不到这个例子。