2013-03-12 53 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. 在启动任务,添加: