Add method to update Store Apps automatically on first logon
This is a reminder of an item I'd like to research.
After OSD Cloud is complete, and the device is ready, trigger a scheduled task a first logon to update store apps.
In command prompt please run
powershell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Then use this script. https://github.com/Abe-Telo/ODSCloud-Missing-Microsoft-Drivers/blob/main/tools/reinstall-preinstalledApps.ps1
In command prompt please run
powershell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Then use this script. https://github.com/Abe-Telo/ODSCloud-Missing-Microsoft-Drivers/blob/main/tools/reinstall-preinstalledApps.ps1
This script is designed to address issues that may occur when Windows isn't activated, such as following a downgrade from Windows 11 to Windows 10. In cases where activation fails, essential default apps—including the Camera app and the Microsoft Store—might not be installed. This scenario can occur in various environments, including when using OSDCloud. Once you successfully activate Windows, running this script will restore the missing apps and the Microsoft Store to your system.
@gwblok Was this what you where looking for?
@Abe-Telo, I was thinking something like this: https://github.com/gwblok/garytown/blob/master/Dev/CloudScripts/PostActionsTask.ps1
Today I run that on my own devices, which creates a scheduled task which runs after OOBE and users have logged in, which triggers store app updates, so that all the store apps get updated. It also reboots the device 5 times then shutsdown, which is what I want in my lab, but not so great for general OSD.
This is the function I call to trigger store updates: (From https://github.com/gwblok/garytown/blob/master/Dev/CloudScripts/Functions.ps1)
Function Invoke-UpdateScanMethodMSStore { try { $AppMan01 = Get-CimInstance -Namespace 'Root\cimv2\mdm\dmmap' -ClassName 'MDM_EnterpriseModernAppManagement_AppManagement01' try { Get-CimInstance -Namespace 'Root\cimv2\mdm\dmmap' -ClassName 'MDM_EnterpriseModernAppManagement_AppManagement01'| Invoke-CimMethod -MethodName UpdateScanMethod | Out-Null } catch { Write-Output "Failed to trigger Updates" } } catch{ Write-Output "Failed to get CimInstance" } }
I read the script and understand a bit of it. Awesome stuff! I will have to test this on a live environment. Hopefully, this works in audit mode, so I might want to use it for my environment. where does this file go PostActionsTask.ps1 and Functions.ps1, in order for it to work? I assume it belongs in a OSDcloud Directory such as automated, provisioning etc?
I ran the script, restarted PC, This is what i see happened,
- it adds to task schedule to run. c:\program\osdcloud\PostActions.ps1
- Then I saw that I was unable to connect to the timezone API. (Also you have a ton of HP stuff that i wont need in my production)
- then there was some error
- but it will restart the computer in 2 min.
After 1st reboot the file does not run in automaticly in audit mode.
I have a similar idea for surface.
- Update date and time. (In WinPE if possible) try again in the Windows environment.
- if in Windows 11, Run a script to fix Explorer.
- check and attempt windows activation.
- install missing drivers using the script preinstalledApps.ps1
- use windows update for drivers, and windows updates.
- reboot; repeat check Windows updates until all updates are completed. (once there is no updates, Remove task )
- Testing faze starts. Copy programs to desktop to test PC.
- start program for testing.
- Record Serial into our DB. With any issues or pass.
- Reboot into OOBE, That will reset evrything on the desktop. PC is ready to be solid.
I will attempt to create this setup, At least part of it. and will update with a link for those who want this for there setup.
Yeah, it wasn't intended for Audit Mode. I keep everything hosted on GitHub, and OSDCloud runs the scripts directly from GitHub.
Basically the scheduled task will run when a user is logged on, which is OOBE as defaultuser0 (after the next reboot). So typically how I deploy devices for myself:
Launch OSDCloud USB -> auto triggers win11.garytown.com -> which runs several "wrapper" processes to OSDCloud, including creating the scheduled tasks that run at first logon. (which is me, logging into my lab device) The scheduled task cleans itself up after 5 reboots. (which it causes by itself.)
So basically I kick off OSDCloud, wait for sign-in, sign in, walk way and wait for the computer to be shutdown automatically (via the scheduled task)
Once it's shut down, I know it's fully updated, including all store apps, and anything else possible. Work good for my lab, probably not the best for production. :-)
And to be fair, what I design has mostly been out of self-interest. :-)
I'm closing this Issue overall, as I don't see myself getting time to work on it.