Use Windows Azure Cloud Services's startup tasks to set the locale and language

Source: Internet
Author: User
Keywords Azure azure tasks

For ductility, Windows Azure Cloud Services does not preserve the state and settings of the local hard disk, so all settings for the system environment and the installation of the software environment must use startup tasks to automate some work when the virtual machine is started. To use Windows Azure Cloud Services Startup Task must be in the Windows Azure Service Definition Schema (. Csdef File). Make related announcements. There is a detailed description of the http://msdn.microsoft.com/en-us/library/windowsazure/gg456327.aspx, for example, I want the virtual machine to execute as a system administrator when it starts Global.cmd batch file and wait until this batch file finishes execution, you can add the following XML declaration to the Servicedefinition.csdef:

< servicedefinition name= "MyService" xmlns= "Http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" >
< Webrole name= "WebRole1" >
< startup>
<task commandline= "Global.cmd" executioncontext= "elevated" tasktype= "simple" >
</Task>
</Startup>
</WebRole>
</servicedefinition>

But how to set the locale and language in Starup Tasks (regional and Language Options) for Taiwan? This matter is more troublesome than imagined. The Windows Azure Guest OS operating system for the current (October 2012) Windows Azure Cloud Services virtual machine is Windows Server 2008 or Windows Server 2008 R2,window S Server 2008 supports PowerShell 1.0, while Windows Server 2008 R2 supports PowerShell 2.0. There is no support for locale and language settings within these two versions of Powershell, so instead of manually setting the locale and language in the Control Panel, other methods are needed.

In the Windows XP era, the locale and language settings can be done by life-side, and the last updated file of this method is http://msdn.microsoft.com/en-ie/goglobal/bb964650% in Windows Vista 28en-us%29.aspx, for example, we can describe the locale and language we want to set in Locale.xml, and execute and set it through the console control.exe at the command line.

Control.exe intl.cpl,,/f: "Locale.xml"

To set the format and the region as Taiwan, you can provide the following locale.xml

<gs:globalizationservices xmlns:gs= "Urn:longhornglobalizationunattend" >

<!--User list-->

<gs:UserList>

<gs:user userid= "Current" copysettingstodefaultuseracct= "true" copysettingstosystemacct= "true"/>

</gs:UserList>

<!--User Locale, change to Taiwan-->

<gs:UserLocale>

<gs:locale name= "zh" setascurrent= "true"/>

</gs:UserLocale>

<!--location, Taiwan, GeoID of Taiwna is 237-->

<gs:LocationPreferences>

<gs:geoid value= "237"/>

</gs:LocationPreferences>

</gs:globalizationservices>

The copysettingstosystemacct= "true" setting in XML is important because even if the current system administrator account locale is modified to Taiwan, it does not represent the system account that initiates IIS NT authority\network SERVICE Will change the locale to Taiwan, the copysettingstosystemacct= "true" will have to be the main system account to do the same set.

Control.exe intl.cpl,,/f can be executed successfully in Windows Server 2008 R2 command-line mode: "Locale.xml" does not mean that it is done, we must add this command to Windows Azure Cloud Services Startup Task. Because this locale will interfere with the virtual machine startup process, I will change the tasktype= "background" to a batch file global.cmd that performs locale at the same time as the virtual machine is started. In addition, this Startup Task interferes with the emulator of the development environment, allowing the development environment to not be able to successfully assign the program to the Windows Azure Compute emulator emulator, so servicedefinition.csdef add the following XML declaration :

<webrole name= "WebRole1" Vmsize= "Sgt" >

<Startup>
< Task commandline= "Global.cmd" executioncontext= "elevated" tasktype= "background" >
<Environment>
< Variable name= "emulated" >
< Roleinstancevalue xpath= "/roleenvironment/deployment/@emulated"/>
</Variable>
</Environment>
</Task>
</Startup>

</WebRole>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.