2013-03-12 54 views
2

運行PowerShell的在我ServiceDefinition.csdef中的文件我有這樣的:從蔚藍的啓動任務

<Startup> 
     <Task commandLine="powershell -ExecutionPolicy Unrestricted -command &quot;Install-WindowsFeature Net-Framework-Core&quot;" taskType="simple" executionContext="elevated"/> 
</Startup> 

但是當我嘗試將其發佈到Azure,我得到:

Cannot find file named 'approot\bin\powershell' for startup task powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Net-Framework-Core" of role WebRole. 

我試着運行powershell,這樣我就可以安裝.net 3.5是OS家族「3」(windows 2012)。該命令從cmd行運行良好,同時遠程訪問我的實例。

什麼是運行powershell的正確語法?

回答

1

我在Michael Volodarsky的幫助下找到了它。

  1. 在 「啓動」 文件夾中創建一個名爲 「install35.cmd」 文件:

PowerShell的-ExecutionPolicy無限制-command 「安裝-WindowsFeature網 - 框架 - 核心」 退出0

  1. 保存/高級/集代碼頁到Windows 1252
  2. 在解決方案資源管理器中,右鍵單擊並設置生成類型=內容,複製始終
  3. 在啓動任務,添加: