开发者

How to silently/automatically install Desktop Experience in Azure?

I need to install Desktop Experience in Azure开发者_Python百科 Worker Role. Installing DE via the command line can be done with:

c:\servermanagercmd -install Desktop-Experience

And then a reboot is required.

How can I best make this work in Azure Worker Role?


UPDATE:

1) Make sure to use OS Family 2 and SDK >=1.3

2) Use elevated startup task to call included batchfile with this command:

3) servermanagercmd -install Desktop-Experience -restart -resultPath results.xml

I have tried

a) to put that commandline in a batch/.cmd file and run it via an elevated startup task. Result: The worker role keeps Aborting and restarts in a neverending loop.

b) I have tried to create a new Process() in OnStart(), under elevated runtime, something like this:

ServiceDefinition.csdef:

 Runtime executionContext="elevated"

WorkerRole.cs:

public override bool OnStart()
{
   if (!System.IO.File.Exists("Startup\\InstallationFinished.txt"))
   {

      Process startup = new Process(); 

      startup.StartInfo.FileName = "Startup\\InstallDesktopExperience.cmd";
      startup.StartInfo.CreateNoWindow = true;
      startup.EnableRaisingEvents = true;
      startup.Start();
      startup.WaitForExit();

      System.IO.File.WriteAllText("Startup\\InstallationFinished.txt", 
            "Installation is complete.");

      startup.StartInfo.FileName = "Startup\\Reboot.cmd";
      startup.Start();
    }

    base.OnStart(); 
}

InstallDesktopExperience.cmd:

servermanagercmd -install Desktop-Experience

Reboot.cmd:

shutdown /r

The result is that the Event Viewer in the Azure Worker Role shows an exception from TrustedInstaller (0xc0000005). After this error is shown in the event log, DE cannot be installed manually by opening a command line window and typing the command either. I get the error:

Error: Installation of [Desktop Experience] failed. Attempt to install Desktop Experience failed with error code 0x80080005. Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))

(but it works by doing it manually in a command line window if I haven't run the code in OnStart)

I'm lost. Thanks in advance for any and all suggestions.


You should reference this guide from Wage Wegner. It deals with Expression Encoder, but the prereq of Desktop Experience is exactly the same:

http://www.wadewegner.com/2011/01/using-expression-encoder-4-in-a-windows-azure-worker-role/


Snippet from the same, but you should take the time to read his explanation on some of these concepts

REM : Install the Desktop Experience
ServerManagerCMD.exe -install Desktop-Experience -restart -resultPath results.xml
REM : Make a folder for the AppData
md "%~dp0appdata"
REM : Change the location of the Local AppData
reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f
REM : Install Encoder
"%~dp0\webpicmd\WebPICmdLine.exe" /accepteula /Products: ExpressionEncoder4 /log:encoder.txt
REM : Change the location of the Local AppData back to default
reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d %%USERPROFILE%%\AppData\Local /f
REM : Exit gracefully
exit /b 0
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜