运行以下powershell命令
invoke-computer -computer computer -scriptblock{remove-item -force \\otherpc\backup_dump\TEST\*}
我收到错误
指定路径上的对象 \ otherpc \ backup_dump \ TEST \没有 存在。
但是当我在本地运行时,它可以工作,我怀疑这里有与范围有关但我不确定,任何帮助都会很棒。
答案 0 :(得分:3)
这是经典的CredSSP问题。检查一下: Mutli-Hop authentication using CredSSP
答案 1 :(得分:0)
您可以使用本地路径(C:\ otherpc \ backup_dump \ TEST *)而不是UNC路径吗?
答案 2 :(得分:0)
远射但是你的(未引用的)路径\ otherpc ...被解释为本地路径?您是否尝试引用路径,如下所示:
... remove-item -force "\\otherpc\backup_dump..."
答案 3 :(得分:0)
将filesystem ::前置到UNC路径。
invoke-computer -computer computer -scriptblock{remove-item -force filesystem::\\otherpc\backup_dump\TEST\*}