I'm trying to set the default locale/region for all users on a Google Compute Engine Windows instance using automated PowerShell startup scripts.
I have tried the following script:
Import-Module International
#set home location to Australia
Set-WinHomeLocation -GeoId 12
# Set locale to English (Australia) (needs a restart)
Set-WinSystemLocale en-AU
# Set regional format (date/time etc.) to English (Australia) - this applies to all users
Set-Culture en-AU
# Set the language list for the user, forcing English (Australia) to be the only language
Set-WinUserLanguageList en-AU -Force
and also this script, using a region xml file to copy the same settings as above to the Default account and System account:
& "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gsutil" cp gs://mybucket/auregion.xml C:\
& $env:SystemRoot\System32\control.exe "intl.cpl,,/f:`"c:\auregion.xml`""
Contents of auregion.xml:
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!--User List-->
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/>
</gs:UserList>
<gs:UserLocale>
<gs:Locale Name="en-AU" SetAsCurrent="true"/>
</gs:UserLocale>
<gs:SystemLocale Name="en-AU"/>
<!--location-->
<gs:LocationPreferences>
<gs:GeoID Value="12"/>
</gs:LocationPreferences>
</gs:GlobalizationServices>
But neither work when set as windows-startup-script-ps1 or as a sysprep-specialize-script-ps1 in GCE. I know the scripts are running, as it also sets the timezone via tzutil which is working, and it does create the auregion.xml file for the second script.
The same scripts work when run by a user remoting into the VM.
Maybe there is an easier way?? I couldn't see any configuration options in GCE to set locale settings automatically, other than creating a custom image.