2010-08-18 100 views
3

運行以下powershell命令刪除項目網絡位置失敗

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

我收到錯誤

一個目的在指定的路徑 \ otherpc \ backup_dump \ TEST \不存在 。

但是當我在本地運行它的時候,我懷疑這裏有一些與範圍有關的事情,但我不確定,任何幫助都會很棒。

回答

0

您可以使用本地路徑(C:\ otherpc \ backup_dump \ TEST *)而不是UNC路徑嗎?

0

一個長鏡頭,但也許你的(無引號)路徑\ otherpc ...被解釋爲本地路徑?您是否嘗試引用的路徑,像這樣:

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

3

這是一個典型的CredSSP問題。選中此項: Mutli-Hop authentication using CredSSP

+0

你的文章是偉大的,但有沒有辦法避免每次發出遠程命令輸入密碼? (與ssh上的ssh-agent相似) – 2013-07-16 11:49:04

+1

您可以使用Get-Credential創建憑證對象並使用-Credential參數。 – ravikanth 2013-07-16 14:46:19