2013-04-26 92 views
0

我在.cmd文件中使用以下腳本來解壓縮壓縮文件,但由於某種原因它保持失敗(它不會在跟蹤偵聽器中說)。PowerShell啓動任務錯誤 - 工作者角色Azure

的powershell -command 「SET-ExecutionPolicy不受限制」 2 >> err.out
$(新物體-com shell.application).namespace( 'd:\')。Copyhere((新建 - 對象-com shell.application).namespace( '的dll \ Myzip.zip')。項目(),0x10),以

我不知道很多有關的PowerShell但是這個代碼似乎許多people..could工作你告訴我什麼是錯的嗎?

+0

您是否嘗試過使用遠程桌面登錄Azure實例並手動運行此腳本? – astaykov 2013-04-26 11:59:39

回答

1

嘗試在聲明啓動任務時設置executionContext =「elevated」屬性。如果未指定,executionContext =「limited」是默認值。

例如:

<Startup> 
    <Task commandLine="foo.cmd" executionContext="elevated" taskType="simple"/> 
</Startup> 

documentation,這樣可以確保「啓動任務以管理員權限運行」 - 這是執行特定的PowerShell運行所需。

相關問題