In one of my sessions this week at the Workplace Ninja Summit, I included a video that showed how you could modify the OOBE flow to prompt for the time zone that should be used in the device, and (very quickly) showed how it worked, promising to post more information. This is that information.
First, I need to provide some additional background. In a perfect world, there would be extensibility to the Windows Autopilot OOBE flow for you to do anything you want. And maybe at some point that capability will be realized. In the meantime, the discussion is simpler: Is there a way to hack up the process to achieve the desired goal? The answer to that is (somewhat) yes.
But then how do we retrieve that value later? Understanding how the web view works is key to that. The Internet Explorer engine running inside the Cloud Experience Host app does it’s normal storage “stuff,” but instead of writing to the user’s IE storage location, it writes to an app-specific location. And it keeps each domain’s data separate, so we just need to poke around a little to find that:
(Yes, figuring that out took more than a few minutes the first time.) So we can see the value that we entered, stored in a nice machine-readable XML file. So, we can read that via PowerShell and use it to set the time zone:
In my case, since I’m using my own MDM service that only knows how to deploy MSI apps (no Win32, no PowerShell), I packaged that script inside an MSI targeted to the computer, so that it runs during device ESP, but you can choose to run it however you want.
So that gives us the pieces:
- A PowerShell script that can process the results from that web site. You can find that here, in the same GitHub repo. (The MSI file and files to create it are there as well, if you want to use it that way.)
And an MSI being delivered to devices that enroll, you end up with something like this:
If you watch through to the end, you’ll see yes, we read the time zone value specified and set it as expected.
A few items to note:
- This only works if the devices have an Autopilot profile assigned. If you try to go through OOBE without having an Autopilot profile (either for a registered device, explicitly assigned, or an existing device using a JSON file), you’ll notice that the time zone still gets set to Pacific Standard Time. It appears that Autopilot alters the timing of this (you can see it logged in C:WindowsPantherUnattendGCsetupact.log) so that the value set by the PowerShell script gets overwritten by OOBE itself.
- The web page is hosted on an Azure app service free tier. Normally I would expect you to clone the page for your own use, but you can use it as-is if you want to. (Note that if you use a different page, you’ll have to update the PowerShell script because the XML file name is based on the URL being used.)
- Maybe at some point the Cloud Experience Host app will switch from using a WebView to instead using a WebView2 control. If that happens, then it will use the Chromium way of storing local data, which will break the PowerShell scritp. I’m guessing we won’t need to worry about that any time soon.