I am trying to change the EC2 instance's Regional format setting:
to en-GB
by running Set-Culture en-GB
command in my user-data script:
<powershell>
# set timezone to GMT
tzutil /s "GMT Standard Time"
# set the date format to the UK -> dd/mm/yyyy (we set it at IIS server level which would apply to all IIS apps automatically)
c:\windows\system32\inetsrv\appcmd.exe set config /commit:WEBROOT /section:globalization /culture:en-GB
c:\windows\system32\inetsrv\appcmd.exe set config /commit:WEBROOT /section:globalization /uiCulture:en-GB
# Set Regional format to UK (affects setting in Region Settings/Region/Regional format dropdown menu)
Set-Culture en-GB
</powershell>
<runAsLocalSystem>true</runAsLocalSystem>
However, when the instance boots up and I RDP to it, I find that the date format is still the default (US) - mm/dd/yyyy
and not the UK format - dd/mm/yyyy
What am I missing here?
Update1
User-Data execution log:
2022/10/16 16:43:00Z: Begin user data script process.
2022/10/16 16:43:00Z: Unable to parse <persist> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:00Z: Sending telemetry bool: IsUserDataScheduledPerBoot
2022/10/16 16:43:00Z: Unregister the scheduled task to persist user data.
2022/10/16 16:43:05Z: Unable to parse <runAsLocalSystem> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:05Z: Unable to parse <script> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:05Z: Unable to parse <powershellArguments> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:05Z: <powershell> tag was provided.. running powershell content
2022/10/16 16:43:12Z: User data script completed.
2022/10/16 17:03:06Z: Begin user data script process.
2022/10/16 17:03:06Z: Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
2022/10/16 17:03:11Z: Launch metadata did not include a user data script.
2022/10/16 17:03:11Z: User data script completed.
2022/10/20 08:27:33Z: Begin user data script process.
2022/10/20 08:27:33Z: Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
2022/10/20 08:27:38Z: Launch metadata did not include a user data script.
2022/10/20 08:27:38Z: User data script completed.
2022/10/21 09:50:52Z: Begin user data script process.
2022/10/21 09:50:52Z: Unable to parse <persist> tags. This can happen when tags are unmatched or poorly formed.
2022/10/21 09:50:52Z: Sending telemetry bool: IsUserDataScheduledPerBoot
2022/10/21 09:50:52Z: Unregister the scheduled task to persist user data.
2022/10/21 09:50:57Z: <runAsLocalSystem> tag was provided: true
2022/10/21 09:50:57Z: Running user data as local system.
2022/10/21 09:50:57Z: Unable to parse <script> tags. This can happen when tags are unmatched or poorly formed.
2022/10/21 09:50:57Z: Unable to parse <powershellArguments> tags. This can happen when tags are unmatched or poorly formed.
2022/10/21 09:50:57Z: <powershell> tag was provided.. running powershell content
2022/10/21 09:52:36Z: Message: The errors from user data script: New-Item : An item with the specified name C:\temp already exists.
At
C:\Windows\system32\config\systemprofile\AppData\Local\Temp\Amazon\EC2-Windows\Launch\InvokeUserData\UserScript.ps1:96
char:1
+ New-Item -Path "C:\temp" -ItemType Directory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (C:\temp:String) [New-Item], IOException
+ FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand
2022/10/21 09:52:36Z: Message: The output from user data script: Join Domain User: ENR\svc_enr_domainjoin
ComputerName: EC2AMAZ-K1I0FAF
Reboot Required...
VERBOSE: Performing the operation "Join in domain 'ENR.cloud'" on target "EC2AMAZ-K1I0FAF".
HasSucceeded ComputerName
------------ ------------
True EC2AMAZ-K1I0FAF
WARNING: The changes will take effect after you restart the computer EC2AMAZ-K1I0FAF.
LocalPath : Z:
RemotePath : \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev
RequireIntegrity : False
RequirePrivacy : False
Status : OK
UseWriteThrough : False
PSComputerName :
Backing up IIS config to backup named 20221021-095225-Login
Creating virtual directories on site: Login
... Adding a virtual directory 'AnnouncementImages' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\AnnouncementImages
- Virtual directory 'IIS:\Sites\Login\AnnouncementImages' created sucessfully
... Adding a virtual directory 'apr' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts\oldAPRStructure
- Virtual directory 'IIS:\Sites\Login\apr' created sucessfully
... Adding a virtual directory 'AprSchematics' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts\apr\schematics
- Virtual directory 'IIS:\Sites\Login\AprSchematics' created sucessfully
... Adding a virtual directory 'BprDiagrams' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts\bpr\diagrams
- Virtual directory 'IIS:\Sites\Login\BprDiagrams' created sucessfully
... Adding a virtual directory 'Charts' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts
- Virtual directory 'IIS:\Sites\Login\Charts' created sucessfully
... Adding a virtual directory 'dls' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\dls
- Virtual directory 'IIS:\Sites\Login\dls' created sucessfully
... Adding a virtual directory 'Pre00CprData' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\Pre2000\cpr
- Virtual directory 'IIS:\Sites\Login\Pre00CprData' created sucessfully
... Adding a virtual directory 'Pre00DprData' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\Pre2000\dpr
- Virtual directory 'IIS:\Sites\Login\Pre00DprData' created sucessfully
... Adding a virtual directory 'Pre15BprData' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\Pre2000\bpr
- Virtual directory 'IIS:\Sites\Login\Pre15BprData' created sucessfully
... Adding a virtual directory 'WBook' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\wbook
- Virtual directory 'IIS:\Sites\Login\WBook' created sucessfully
Applied configuration changes to section "system.web/globalization" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT"
Applied configuration changes to section "system.web/globalization" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT"
PSPath : Microsoft.PowerShell.Security\Certificate::LocalMachine\my\0F006BBA30488C454380998CD818B7933
CBABB7F
PSParentPath : Microsoft.PowerShell.Security\Certificate::LocalMachine\my
PSChildName : 0F006BBA30488C454380998CD818B7933CBABB7F
PSIsContainer : False
Archived : False
Extensions : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
System.Security.Cryptography.Oid, System.Security.Cryptography.Oid}
FriendlyName : myTeamId
IssuerName : System.Security.Cryptography.X509Certificates.X500DistinguishedName
NotAfter : 10/21/2023 10:02:35 AM
NotBefore : 10/21/2022 9:42:35 AM
HasPrivateKey : True
PrivateKey :
PublicKey : System.Security.Cryptography.X509Certificates.PublicKey
RawData : {48, 130, 3, 42...}
SerialNumber : 3A249AE70AC9BC96464EDE49BEDD319B
SubjectName : System.Security.Cryptography.X509Certificates.X500DistinguishedName
SignatureAlgorithm : System.Security.Cryptography.Oid
Thumbprint : 0F006BBA30488C454380998CD818B7933CBABB7F
Version : 3
Handle : 1568489766128
Issuer : CN=EC2AMAZ-K1I0FAF
Subject : CN=EC2AMAZ-K1I0FAF
EnhancedKeyUsageList : {Client Authentication (1.3.6.1.5.5.7.3.2), Server Authentication (1.3.6.1.5.5.7.3.1)}
DnsNameList : {EC2AMAZ-K1I0FAF}
SendAsTrustedIssuer : False
EnrollmentPolicyEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
EnrollmentServerEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
PolicyId :
2022/10/21 09:52:36Z: User data script completed.