运行以下powershell命令删除项目网络位置失败
invoke-computer -computer computer -scriptblock{remove-item -force \\otherpc\backup_dump\TEST\*}
我收到错误
一个目的在指定的路径 \ otherpc \ backup_dump \ TEST \不存在 。
但是当我在本地运行它的时候,我怀疑这里有一些与范围有关的事情,但我不确定,任何帮助都会很棒。
运行以下powershell命令删除项目网络位置失败
invoke-computer -computer computer -scriptblock{remove-item -force \\otherpc\backup_dump\TEST\*}
我收到错误
一个目的在指定的路径 \ otherpc \ backup_dump \ TEST \不存在 。
但是当我在本地运行它的时候,我怀疑这里有一些与范围有关的事情,但我不确定,任何帮助都会很棒。
您可以使用本地路径(C:\ otherpc \ backup_dump \ TEST *)而不是UNC路径吗?
一个长镜头,但也许你的(无引号)路径\ otherpc ...被解释为本地路径?您是否尝试引用的路径,像这样:
... remove-item -force "\\otherpc\backup_dump..."
这是一个典型的CredSSP问题。选中此项: Mutli-Hop authentication using CredSSP
将文件系统::预先挂载到UNC路径。
invoke-computer -computer computer -scriptblock{remove-item -force filesystem::\\otherpc\backup_dump\TEST\*}
你的文章是伟大的,但有没有办法避免每次发出远程命令输入密码? (与ssh上的ssh-agent相似) – 2013-07-16 11:49:04
您可以使用Get-Credential创建凭证对象并使用-Credential参数。 – ravikanth 2013-07-16 14:46:19