开发者

remove-item network location using invoke-command on remote computer fails

开发者 https://www.devze.com 2023-01-12 17:52 出处:网络
Running the following powershell command invoke-computer -computer computer -scriptblock{remove-item -force \\\\otherpc\\backup_dump\\TEST\\*}

Running the following powershell command

invoke-computer -computer computer -scriptblock{remove-item -force \\otherpc\backup_dump\TEST\*}

I receive the error

An object at the specified path \otherpc\backup_dump\TEST\ does not exist.

But when I run it locally it works, I suspect there is something to do with scope here b开发者_StackOverflow中文版ut I'm not sure of that, any help would be great.


This is the classic CredSSP issue. Check this: Mutli-Hop authentication using CredSSP


Could you use the local path (C:\otherpc\backup_dump\TEST*) instead of the UNC path?


A long shot but maybe your (unquoted) path \otherpc... is interpreted as a local path? Have you tried quoting the path, like so:

... remove-item -force "\\otherpc\backup_dump..."


Prepend filesystem:: to the UNC path.

invoke-computer -computer computer -scriptblock{remove-item -force filesystem::\\otherpc\backup_dump\TEST\*}

See http://www.powershellmagazine.com/2012/11/05/pstip-using-unc-paths-when-working-with-powershell-providers/

0

精彩评论

暂无评论...
验证码 换一张
取 消