Great article, very well structured! I am sure it will be useful for many administrators into guiding their end users into such reports, and also for the admins themselves.
Keep up the good work and thanks for sharing this with us! 🙂
Thank you! I managed to run the cpi command from Powershell, but this time I am getting “Access Denied” errors while copying source files to destination. What can I do to fix this issue?
Microsoft have given their own script that I believe does the same thing, but to figure this out on your own and develop your own solution is very impressive. I tip my hat to you
One last question, we have W10 1803 x64 and we now used the Microsoft.WindowsCommunicationsApps_8wekyb3d8bbwe.appxbundle
Microsoft.WindowsCommunicationsApps_8wekyb3d8bbwe.xml
from the x86fre folder. What is the difference with the same files from the amd64fre folder on the Inbox ISO? Just to make sure we use the right files.
It’s just like for other application scenarios:
– which one are you supporting,
– which one are fitting to your operating system,
– do you have other dependency packages/applications?
I would definitely recommend to use amd64/arm64 for your W10 x64 architecture. But for sure it’s working with x86 apps too.
I’m having this same issue. I’ve double checked the version, 1803 for both so that doesn’t appear to be the cause. I’ve tried multiple packages on the possibility there was something peculiar about Calculator, but everything seems to do the same.
For Calculator, Alarms or StickyNotes, you could simply redeploy the AppX:
Get-AppxPackage -allusers *windowscalculator* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}
I had actually found and tried that method as well. However I found that everytime the machine reboots the calculator fails. It doesn’t present the ‘you need a new app’ dialog, just silently fails. . It also only installs for the active user so if another user logs in it isn’t available.
Getting the same error ‘Element Not Found’ trying to reprovision skype app by running Add-AppxProvisionedPackage -Online -PackagePath “G:\amd64\Microsoft.SkypeApp_kzf8qxf38zg5c.appxbundle” –LicensePath “G:\and64\Microsoft.SkypeApp_kzf8qxf38zg5c.xml”
I can add for individual users by running get-appxpackage -AllUsers Microsoft.SkypeApp | foreach { Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml” }
but need Skype app to be installed autmatically for new users logging
I have seen this mentioned elsewhere, but nobody ever said where to get the ISO from. Thank you so much for that! Also, your one-liner is better than their 4 lines of code!
Getting Element not Found error attemting to reinstall Skype App.
Using command Add-AppxProvisionedPackage -Online -PackagePath “G:\amd64fre\Microsoft.SkypeApp_kzf8qxf38zg5c.appxbundle” –LicensePath “G:\and64fre\Microsoft.SkypeApp_kzf8qxf38zg5c.xml”
Version are correct
I can reinstall Skype app for logged in users using command get-appxpackage -AllUsers Microsoft.SkypeApp | foreach { Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml” }
But is not provisioned for new users logging in
4. Right click on the ‘WindowsApps’ folder and click on ‘Take Ownership’ in the context menu
(This will give you permission to access the WindowsApps folder)
5. Now open the ‘WindowsApps’ folder and find a folder named ‘Microsoft.WindowsStore_11909.1001.7.0_x64__8wekyb3d8bbwe’ and open it
(your folder name may be slighty different)
6. Find the file named ‘AppxManifest.xml’ and right click and copy this file
7. Go to ‘My Computer’ or ‘This PC’ and go to your Local Disk (C:)
8. Paste the ‘AppxManifest.xml’ file directly in your (C:) directory
9. Open and run ‘Command Prompt’ as an ‘Administrator’.
10. Copy and paste the command: PowerShell -ExecutionPolicy Unrestricted
11. Copy and paste the command: $manifest = (Get-AppxPackage Microsoft.WindowsStore).InstallLocation + ‘\AppxManifest.xml’ ; Add-AppxPackage -DisableDevelopmentMode -Register $manifest
12. Close command prompt and open the Run command by pressing ‘Windows Key + R’ and type in WSReset.exe and hit enter
13. Wait for the WSReset command to close and restart your PC.
14. Welcome back to the Windows Store!! 🙂
Guide created by: Luke Jordan 30091990.. PLEASE LIKE AND SHARE IF IT HELPED YOU!!
Absolutely brilliant. Well explained and easy to follow, perfect results in restoring the entire Store and other apps! Thank you for sharing your knowledge. Cheers!
Actually, you have to get this “special” ISO for inbox apps which is only available via VLSC portal.
Take care, as I mentioned in the blog, this file is depending on your W10 build.
I don’t have access to VLSC, is there a way to get this iso? Formatting the computer sounds like overkill to me, I refuse to do that just for getting the Store back.
We had a third party image our devices and had removed store (unknown to us) – thankfully your solution worked now we can use our Business Store. Thanks very much for this!
Great information, have been looking to get a few apps back into an image. One question, the Add-AppxProvisionedPackage does not seem to install the app on other user accounts, is there a way to have it install for all users?
I see here following options:
– You can use the command Add-AppxProvisionedPackage cmdlet with the -Online switch
– Use DISM command: DISM.EXE /Online /add-ProvisionedAppxPackages
– You can create a run once task which will be executed after each user logon.
– Or a “back-to-the-roots” solution could be a simple scheduled ask with a login trigger.
Can anyone tell me I were to get a few Enterprise licenses, so that I can get access to the Windows 10 Inbox Apps, would I be able to download the Windows 10 Inbox Apps for my non-enterprise versions of Windows 10 which is 1909? Thanks
I tried this on our Virtual Master W10 Image. It worked and the two packages I wanted came back and both loaded without issue. However, I then rolled this image out to the users and none of them see these two apps on their start menu like I do on the master image. I have tried the -allusers switches etc. Can anyone suggest anything not already mentioned?
Yes, it didnt make any difference. I’ve re-installed Sticky Notes, Photo Viewer and Snip and Sketch. They all appear under Start in the list and all open perfectly ok as the local administrator account on the Master Image. Once I roll this image out to create desktops for users, these desktops do not have these icons anywhere. I have tried all the commands with -allusers etc but they dont appear.
I just picked up a Lenovo ThinkPad from a thrift store when I got it powered up and tapped F9 at first screen I found “computrace” and then some how ended up at the “Administrator:X:\windows\system32\cmd.exe” screen with the same message anyone have suggestions? I’m kinda worried about putting in any commands at this point.
I just picked up a Lenovo ThinkPad from a thrift store when I got it powered up and tapped F9 at first screen I found “computrace” and then some how ended up at the same screen with the same message anyone have suggestions? I’m kinda worried about putting in any commands at this point.
I tried this on our Virtual Master W10 Image. It worked and the two packages I wanted came back and both loaded without issue. However, I then rolled this image out to the users and none of them see these two apps on their start menu like I do on the master image. I have tried the -allusers switches etc. Can anyone suggest anything not already mentioned?
I removed majority of default apps from 1803 x64 image, Recently In-place upgraded the same image to 1909. Now, I want to add Snip & Sketch alone using the powershell ….
Get-AppXPackage -AllUsers -Name Microsoft.screensketch | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml” -Verbose}
but its failing with error like “AppxManifest.xml because the manifest is not in the package root.” I manually copied the Microsoft.screensketch to WindowsApps folder. Appreciate your help in restoring the Snip & Sketch to all our clients (about 1k)
Hi, I have a same problem. I wrote the command in your screeenshot. Now, my CMD screen looks same but I don’t know what I will do after that.. Im not very well on CMD copy paste things. Please help me.. thanks ..
It’s now March 2021 and I have just encountered this problem for the first time with a Windows 10 update. Hoping your solution still works. Will give it a go.
Thanks.
I really appreciate your help! Regarding the powershell script can you explain why is necessary the control around flg file if there is a loop to skip the installation if the apps has been already deployed.
Is the flg part of the microsoft internal control, I couldn’t find any created in my template.
FLG file is not even necessary. With this, you can just track in which situation has been this missing are reinstalled. Like in MECM a detection rule. It has been deployed for my own use. It’s definitely not from Microsoft.
Hi,
You can try to add a setupcomplete.cmd script during the winpe phase that runs your OOBE scripts. It will run after reboot, before OOBE but on the real OS.
Or you can change unattend.xml to run the script during OOBE phase.
Brilliant idea! Have you managed to kick off oobe scripts this way without manually start oobedeploy? Really like the zti deployment but it would be nice to automatically install netfx and add/ remove appx during OOBE without manually starting the scripts.
Trigger an executable, is for me still unknown. But definitely, it would be a great opportunity to execute the next commands automatically. #CommunityQuestion
OOBE.cmd location doesn’t matter. I am placing into C:\Windows\System32, because after Shift+F10 I am already in this folder.
Regarding SetupComplete.cmd, it starts before OOBE phase comes up.
But it seems to run even before the real OOBE (before the last reboot actually), and thus it has limitations (not all powershell stuff is supported). I am searching for a way to auto-start every script we need in the OOBE phase under the temporary defaultuser0 user. This way the AutopilotOOBE window can popup without having to use Shift+F10 at all.
Can you please add some example how to use the PowerShell wrapper which you have created for Surface Drivers Issue. I am facing the same issue and still wanted to use the automated way to deploy the drivers.
I understand that we need to define the $Global variable before launching the Start-OSDCloud command but where we need to use the Powershell Wrapper to define the model?
Hi Henrik, you can put the your scripts together in the OOBE.cmd which you can start after Shift+F10. And yes, OSDeploy.AutopilotOOBE.json and OSDeploy.OOBEDeploy.json are your best friends for the customization.
Nope, running “iex (irm sandbox.osdcloud.com)” is not required.
Do you then use an SMB share or web server to host all of your pre-downloaded OS ESDs and Vendor Driver Packs, or does each machine then pull directly from the Internet?
Oh, I was hoping you were going to give me the solution to imaging 50 machines at once without blowing through a bunch of Internet data 😉 Why else go through the trouble of using PXE over USB?
When you are creating the basic OSD image, you can put the ESD URL in it, which is locating internally. https://www.osdcloud.com/deploy/wim#findimagefile
Then create the ISO file and “convert” it into a WIM.
Using USB doesn’t require an own network infra (like WDS, PXE VLAN), only the right firewall rules.
Thanks. What I’m really after is replicating the offline USB model where I can have many different original ESD files and driver packs cached on an SMB, or better yet, local web server. Then set a variable/global variable to have OSDCloud check there before downloading from the official source.
For those of you trying to do this all via WiFi, is it possible to automate the connection at the start of OOBE using the WiFi.json file that was created in the WinPE phase.
I’ve tried both methods to generate the WIM from the ISO (DISM and ImageX) – both produce a WIM file but I cannot import them into WDS as a boot image, or an install image – It says not a valid boot image / not a valid install image.
The issue comes when you import the converted WIM file. Please select only the boot.wim file from the ISO (..\sources).
–> I will update this blog post
Hello Ákos,
when I run your W11_OOBEcmd.ps1 in my ScriptPad, the Deployment comes till the AutopilotGUI, but the Register Button don’t work.
In the PS is message that the Button is only active when the defaultuser0 is logged in.
In the OOBE phase when you press Shift+F10, you are “automatically” logged in as defaultuser0. So, this Autopilot registration with the register button only works in this phase.
With a simple “whoami”, you can figure out, who you are 😉
in the OOBE Phase a CMD and a PS Windows open automatically. When i write whoami in the cmd, i get defaultuser0.
The ps scripts are running, the Autopilot GUI opens, but the Register Button don’t work. What I doing wrong? I take your “W11_OOBEcmd.ps1” for testing.
When you follow my instructions, my guess, that the OOBE scripts are running with SYSTEM credentials (aka. in Session 0). So, the script will skip this part.
When you open a shell, you are with defaultuser0 credential in Session 1.
I don’t understand this part:
“If you need the register button, you have to work with defaultuser0 and/or you can fully automate this part of the OSD as well”
Do I need to make changes in the scheduled Task,? Both Scheduled Task run from Serviceui.exe.
Do I need to make changes in your “W11_OOBEcmd.ps1” or in your “oobetasks.ps1”
Thanks for your help!!
When running your ZTI process, I get a warning with Start-AutopilotOOBE : “The register button is disabled when the UserName is not defaultuser0”
I’m unable to click the register button in the GUI
Do you mean triggering the OOBE tasks automatically?
I am using this solution: oobetasks.osdcloud.ch
And in the post below, you can find the SetupComplete.cmd which is creating these scheduled tasks in the specialize phase.
When running your ZTI process, I get a warning with Start-AutopilotOOBE : “The register button is disabled when the UserName is not defaultuser0”
I’m unable to click the register button in the GUI
I used your script that you referenced, everything works apart from the register button not being clickable.
You can try to start the scheduled task as ‘defaultuser0’, either as SYSTEM with ServiceUI.exe.
Or just create a simple CMD into C:\Windows\System32 and click manually Shift+F10. Then you are ‘defaultuser0’ and can execute the previously created batch file.
You have to switch the account in the task scheduler. In my example, the OOBE scripts are running in a SYSTEM context.
I don’t need the register button, because I am working with an offline Autopilot JSON file which is registering and assigning automatically.
You have to switch the account in the task scheduler. In my example, the OOBE scripts are running in a SYSTEM context.
I don’t need the register button, because I am working with an offline Autopilot JSON file which is registering and assigning automatically.
Instead of using Task Scheduler, you can add your both scripts “SendKeys” and “OOBE” in local Logonscript folder. (C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logon) In this way AutoPilot registration can be run as “defaultuser0” and the button will be acitv.
I know this is more static, but if i have local powershell scripts i want to run with SetupComplete, how do i do that? Not having them in uploaded to Github.
Lets say i have three powershell scripts i my WinPE image.
I want to copy them to the C-drive and runt them in OOBE.
Thanks Akos for the Amazon series on OSSCLOUD, I understand the workflow you are trying to explain in this but just wondering how to call the script in the OOBE phase
I am setup the Zero touch deployment but can’t get my head around what to do next, my company doesn’t allow hosting anything on GitHub so that’s not an option
That’s a bit the tricky part. In the specialize phase, two scheduled tasks have been created which are getting triggered in the OOBE phase.
During my solutions, I am always referencing for an online script repository (GitHub/Azure), but these ones can work for sure with local scripts as well. You should import them into the boot.wim and in the WinPE phase care about for the copy job into C:\.
PS: I think we could have here a better and easier way, but so far I am still happy with this solution.
You can only use the following parameters in Start-OSDcloud function:
ImageFileFullName = $null
ImageFileItem = $null
ImageFileName = $null
ImageFileSource = $null
ImageFileDestination = $null
ImageFileUrl = $ImageFileUrl
“ImageFileOffline” is not anymore usable as a variable. (so far, as I know)
You note that Internet is required, I would disagree. I have everything synced to the flash drive. I can boot to the flash and get to OOBE login fully offline.
If i run Start-OOBEDeploy in OOBE with Schedule Task and SYSTEM (from you scripts) Start-OOBEDeploy starts running but then quits not updating windows….
If i run it manually from powershell i OOBE it works without any problem. Do you know how to solve this?
hope you are doing well. I’ve used the fully automated flow for a few months now. It worked fully at the beginning but right now i have the problem that the scheduled task gets registered, but gets not started until I start it manually or reboot the machine.
Do you know this problem or maybe have an idea which parameters I could change?
Are the process running, but you are just not seeing (SYSTEM <- -> defaultuser0)? Or they didn’t start at all? You can try to increase the delay. Otherwise wait some days until I post my newest thing about post OOBE tasks… 😉
Which directory do I save modified Start-OSDCloudGUI.json file at? The post shows a different workspace structure? I have OSD 24.5.14.1. Thank you for your reply.
For any one interested in running a PS Script AUTOMATICALLY right at the start of OOBE here is how do this. I just did for Win 11 Hyper-V VM and it worked
1- Create the Setupcomplete.cmd file using the following
2- Install Windows System Image Manager as part of ADK (Downlaod ADK from MS official site as an MSI and install the MSI which will put Windows System image manager in your start menu)
3- Open Windows System Image Manager and create a new answer file (unattend.xml)
4- Open your WIM file (if you do not have a WIM file I converted ISO to VHDX then I captured the VHDX into a WIM)
5- Add RunsynchronousCommand to phase 4 which is the specialize phase
6- in the RunsynchronousCommand path add cmd /c C:\Windows\Setup\Scripts\SetupComplete.cmd for the command path so your unattend.xml should look like this
8- then create a new Hyper-V and use the VHDX from step 7 as a parent for a differencing disk so that way your VM boot directly into the specialize phase skipping windows install
9- in the specialize phase you will a cmd window pop up which will run the setupcomplete.cmd specified in the unattend.xml specialize phase
10- then the VM will reboot and then come to the OOBE screen and within 15 seconds the scheduled tasks will automatically kick in and start running your PowerShell scripts
I tried it at the script runs before the OOBE phase, the machine reboots and then the normal OOBE is showing up like here (https://i.ibb.co/DVCVRx6/oobe.png). Am I missing something?
That looks good. Meaning, that the scripts have been executed successfully.
Now you can debug each for these scripts what they are doing wrong and/or which scripts you really need in this phase.
I have the oobe.cmd placed in the Setup\Script folder, after OCD does its thing it boots up to the AutopilotOOBE Gui but you can’t click the Register button as it states that it needs to run as default0 user which does not exist. If I put the oobe.cmd somewhere else and use Shift/F10 and run it manually it works just fine. I must be missing something as I thought it would trigger the Gui automatically and be able to register
If you look at the Get-WindowsAutopilotInfo scriot, you realize that there is only a couple of infos you need. Get the hash, get the serial and the product key (empty) and use a group tag. With this infos you will be able to automate the registration using an Azure Function. No GUI or user interacton at all.
Permalink
Permalink
Permalink
Permalink
Permalink
Permalink
Permalink
Permalink
Permalink
Hi, is this also possible in hybrid (Intune via SCCM)?
Permalink
Hallo Mike, for sure.
Same configs are available in SCCM console as well.
Permalink
Great article, very well structured! I am sure it will be useful for many administrators into guiding their end users into such reports, and also for the admins themselves.
Keep up the good work and thanks for sharing this with us! 🙂
Permalink
Oana, thanks for your nice words.
And thanks again for working together to solve my issue.
Permalink
This worked great, Thanks
Permalink
Solution 2, are they command or? how did you do it?
Permalink
I got “‘cpi’ is not recognized as an internal or external command,
operable program or batch file. error.” Can you help please?
Permalink
You can use Copy-Item, Copy or CP as standard aliases too.
Permalink
Thank you! I managed to run the cpi command from Powershell, but this time I am getting “Access Denied” errors while copying source files to destination. What can I do to fix this issue?
Permalink
Thanks for sharing !
Permalink
Solution1 works like a charm – many thx
Permalink
Thanks so much, this saved my bacon!!
Permalink
Do you know the commands in powershell to reinstall the NET.Native and VCLibs appx files?
We have problems after the sysprep to install them and other native apps.
Permalink
This ISO contains these required files too. You can just use the same one-line script for the installation as well.
Permalink
I got this to work once, but now, with 1709 and 1803 (using their proper packages) i get the following error. Thoughts?
Add-AppxProvisionedPackage : Element not found.
At line:1 char:1
+ Add-AppxProvisionedPackage -Online -PackagePath “D:\amd64fre\Microsof …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-AppxProvisionedPackage], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.AddAppxProvisionedPackageCommand
Permalink
Both Solutions are working.
I have used power shell command(Copy-Item “C:\W10_1803\MountBOOT\sources” -Destination “C:\W10_1803\MountWINRE” -Recurse) for copy the files
Thank You !
Permalink
You sir, are a gentleman and a scholar.
Microsoft have given their own script that I believe does the same thing, but to figure this out on your own and develop your own solution is very impressive. I tip my hat to you
Permalink
Hi,
We succesfully restored the Mail and Calender app by your guide.
Great article!
Thank you!
Permalink
I’m happy to help you, guys!
Permalink
One last question, we have W10 1803 x64 and we now used the Microsoft.WindowsCommunicationsApps_8wekyb3d8bbwe.appxbundle
Microsoft.WindowsCommunicationsApps_8wekyb3d8bbwe.xml
from the x86fre folder. What is the difference with the same files from the amd64fre folder on the Inbox ISO? Just to make sure we use the right files.
Permalink
It’s just like for other application scenarios:
– which one are you supporting,
– which one are fitting to your operating system,
– do you have other dependency packages/applications?
I would definitely recommend to use amd64/arm64 for your W10 x64 architecture. But for sure it’s working with x86 apps too.
Permalink
You’re a lifesaver!
Excellent guide!
Permalink
You can’t use the same line for NET.Native and VCLibs because there is no corresponding license file… unless it doesn’t need it?
Permalink
For these Appx’s (Microsoft.NET.Native.Runtime* and Microsoft.VCLibs*) you don’t need the licensepath parameter. Either use -SkipLicense!
Permalink
Great!!!! that was usefully!!
Permalink
thanks for this, we accidentally uninstalled it 🙂
Permalink
I am getting “Add-AppxProvisionedPackage : Element not found.” when I run the command
any idea what could be the issue ?
Permalink
Maybe, because that is not the version that applies to your W10 build.
Permalink
I’m having this same issue. I’ve double checked the version, 1803 for both so that doesn’t appear to be the cause. I’ve tried multiple packages on the possibility there was something peculiar about Calculator, but everything seems to do the same.
Permalink
For Calculator, Alarms or StickyNotes, you could simply redeploy the AppX:
Get-AppxPackage -allusers *windowscalculator* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}
Permalink
I had actually found and tried that method as well. However I found that everytime the machine reboots the calculator fails. It doesn’t present the ‘you need a new app’ dialog, just silently fails. . It also only installs for the active user so if another user logs in it isn’t available.
Permalink
Getting the same error ‘Element Not Found’ trying to reprovision skype app by running Add-AppxProvisionedPackage -Online -PackagePath “G:\amd64\Microsoft.SkypeApp_kzf8qxf38zg5c.appxbundle” –LicensePath “G:\and64\Microsoft.SkypeApp_kzf8qxf38zg5c.xml”
I can add for individual users by running get-appxpackage -AllUsers Microsoft.SkypeApp | foreach { Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml” }
but need Skype app to be installed autmatically for new users logging
Thanks
George
Permalink
no it will not if you have deleted that app for all users or deleted the provisionalpackage.
Permalink
that worked!
thanks for the info!
Permalink
Solution 1 worked. Thx!
Permalink
What do i have to type in cmd to run the file?
Permalink
powershell.exe -command “& {Add-AppxProvisionedPackage -Online -PackagePath “X:\x86fre\Microsoft.WindowsStore_8wekyb3d8bbwe.appxbundle” –LicensePath “X:\x86fre\Microsoft.WindowsStore_8wekyb3d8bbwe.xml”}”
Permalink
Can you please help me on this
Permalink
Can you please help me on this
Permalink
I have seen this mentioned elsewhere, but nobody ever said where to get the ISO from. Thank you so much for that! Also, your one-liner is better than their 4 lines of code!
Permalink
Thanks for this tip, I was able to restore Microsoft Photos on my master image!
Permalink
Getting Element not Found error attemting to reinstall Skype App.
Using command Add-AppxProvisionedPackage -Online -PackagePath “G:\amd64fre\Microsoft.SkypeApp_kzf8qxf38zg5c.appxbundle” –LicensePath “G:\and64fre\Microsoft.SkypeApp_kzf8qxf38zg5c.xml”
Version are correct
I can reinstall Skype app for logged in users using command get-appxpackage -AllUsers Microsoft.SkypeApp | foreach { Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml” }
But is not provisioned for new users logging in
Thanks
George
Permalink
why you even tried to install provisionedpackage if you already had that app in your machine?
Permalink
Thank you!!! Thank you!!! Thank you!!! Searched for HOURS and finally stumbled upon your recommendation and it worked like a champ!
Permalink
How i download Windows 10 Inbox Apps without VLSC?
Permalink
If you (your organization) has EA, you should habe VLSC access. Or simply you can try to create a new account: http://bit.ly/2Na7Nv9
Permalink
1. Download the TakeOwnership file from MediaFire and unzip it: https://www.mediafire.com/file/6zfp7q7ta7s90qx/TakeOwnership.zip/file
2. Run the file named: InstallTakeOwnership.reg
3. Navigate to: C:\Program Files\WindowsApps
4. Right click on the ‘WindowsApps’ folder and click on ‘Take Ownership’ in the context menu
(This will give you permission to access the WindowsApps folder)
5. Now open the ‘WindowsApps’ folder and find a folder named ‘Microsoft.WindowsStore_11909.1001.7.0_x64__8wekyb3d8bbwe’ and open it
(your folder name may be slighty different)
6. Find the file named ‘AppxManifest.xml’ and right click and copy this file
7. Go to ‘My Computer’ or ‘This PC’ and go to your Local Disk (C:)
8. Paste the ‘AppxManifest.xml’ file directly in your (C:) directory
9. Open and run ‘Command Prompt’ as an ‘Administrator’.
10. Copy and paste the command: PowerShell -ExecutionPolicy Unrestricted
11. Copy and paste the command: $manifest = (Get-AppxPackage Microsoft.WindowsStore).InstallLocation + ‘\AppxManifest.xml’ ; Add-AppxPackage -DisableDevelopmentMode -Register $manifest
12. Close command prompt and open the Run command by pressing ‘Windows Key + R’ and type in WSReset.exe and hit enter
13. Wait for the WSReset command to close and restart your PC.
14. Welcome back to the Windows Store!! 🙂
Guide created by: Luke Jordan 30091990.. PLEASE LIKE AND SHARE IF IT HELPED YOU!!
Permalink
Thank you very much!
Permalink
Absolutely brilliant. Well explained and easy to follow, perfect results in restoring the entire Store and other apps! Thank you for sharing your knowledge. Cheers!
Permalink
Hi I don’t have VLSC, is there another way to get the iso? Or maybe use the “normal” iso?
Permalink
Actually, you have to get this “special” ISO for inbox apps which is only available via VLSC portal.
Take care, as I mentioned in the blog, this file is depending on your W10 build.
Permalink
I don’t have access to VLSC, is there a way to get this iso? Formatting the computer sounds like overkill to me, I refuse to do that just for getting the Store back.
Permalink
If you (your organization) has EA, you should habe VLSC access. Or simply you can try to create a new account: http://bit.ly/2Na7Nv9
Permalink
I’ve an windows 10 v1909 image without microsoft store on several machines. A Windows 10 Inbox Package for v1909 isn’t availible in VLSC.
Do oyu have any hint? :-/
Thank you very much and btw great post 😉
Permalink
Hi Jens, you can simply try to use the ISO file from the 1903 image:
SW_DVD9_NTRL_Win_10_1903_32_64_ARM64_MultiLang_App_Update_X22-01657.ISO
You can install a new computer from scratch and check the Windows Store version. If you have the same version on the ISO, you won. 😉
Permalink
We had a third party image our devices and had removed store (unknown to us) – thankfully your solution worked now we can use our Business Store. Thanks very much for this!
Permalink
Great information, have been looking to get a few apps back into an image. One question, the Add-AppxProvisionedPackage does not seem to install the app on other user accounts, is there a way to have it install for all users?
Permalink
I see here following options:
– You can use the command Add-AppxProvisionedPackage cmdlet with the -Online switch
– Use DISM command: DISM.EXE /Online /add-ProvisionedAppxPackages
– You can create a run once task which will be executed after each user logon.
– Or a “back-to-the-roots” solution could be a simple scheduled ask with a login trigger.
Permalink
Can anyone tell me I were to get a few Enterprise licenses, so that I can get access to the Windows 10 Inbox Apps, would I be able to download the Windows 10 Inbox Apps for my non-enterprise versions of Windows 10 which is 1909? Thanks
Permalink
You can use the same appbundle’s for other versions too.
Permalink
I tried this on our Virtual Master W10 Image. It worked and the two packages I wanted came back and both loaded without issue. However, I then rolled this image out to the users and none of them see these two apps on their start menu like I do on the master image. I have tried the -allusers switches etc. Can anyone suggest anything not already mentioned?
Permalink
‘kill -n explorer’ already tried?
Permalink
No, I haven’t tried this. What would this achieve?
Permalink
Yes, it didnt make any difference. I’ve re-installed Sticky Notes, Photo Viewer and Snip and Sketch. They all appear under Start in the list and all open perfectly ok as the local administrator account on the Master Image. Once I roll this image out to create desktops for users, these desktops do not have these icons anywhere. I have tried all the commands with -allusers etc but they dont appear.
Permalink
Check the latest blog update (script). Hope it helps you.
Permalink
What do I do after the first solution, do I wait or do a command, please help me.
Permalink
Hi Jack, try to run this newly founded RecEnv.exe; with the correct path.
Permalink
What does that mean, im sorry im not that tech person that knows everything, could you explain it to me please.
Permalink
Which kind of W10 editions do you have? Home, Pro or Enterprise?
In which phase do you have this issue? OSD setup, feature upgrade?
Permalink
I believed I had a Pro Edition, or a home. I haven’t checked but I think i have pro.
Permalink
I just picked up a Lenovo ThinkPad from a thrift store when I got it powered up and tapped F9 at first screen I found “computrace” and then some how ended up at the “Administrator:X:\windows\system32\cmd.exe” screen with the same message anyone have suggestions? I’m kinda worried about putting in any commands at this point.
Permalink
I just picked up a Lenovo ThinkPad from a thrift store when I got it powered up and tapped F9 at first screen I found “computrace” and then some how ended up at the same screen with the same message anyone have suggestions? I’m kinda worried about putting in any commands at this point.
Permalink
Either bring the laptop back to the reseller, or create your self a new installation media via USB:
https://www.microsoft.com/en-us/software-download/windows10ISO
Permalink
I tried this on our Virtual Master W10 Image. It worked and the two packages I wanted came back and both loaded without issue. However, I then rolled this image out to the users and none of them see these two apps on their start menu like I do on the master image. I have tried the -allusers switches etc. Can anyone suggest anything not already mentioned?
Permalink
Hi for solution 1 ..it says file not found.
Permalink
I tried the one-line script and successfully installed the windows store package, but the app won’t launch when I try to start it
Permalink
Maybe it’s a “hidden” AppLocker policy? Check quickly in Event viewer
Permalink
I checked the Event viewer. The following log appeared when I try to launch Microsoft Store.
Fault bucket , type 0
Event Name: AppxDeploymentFailureBlue
Response: Not available
Cab Id: 0
Permalink
When I try to launch Microsoft Store, this log appeared.
Event Name: AppxDeploymentFailureBlue
Source: Windows Error Reporting
Event ID:1001
Level: Information
Permalink
Thanks for the help
Permalink
Hi,
I removed majority of default apps from 1803 x64 image, Recently In-place upgraded the same image to 1909. Now, I want to add Snip & Sketch alone using the powershell ….
Get-AppXPackage -AllUsers -Name Microsoft.screensketch | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml” -Verbose}
but its failing with error like “AppxManifest.xml because the manifest is not in the package root.” I manually copied the Microsoft.screensketch to WindowsApps folder. Appreciate your help in restoring the Snip & Sketch to all our clients (about 1k)
Many thanks
AMK
Permalink
Add-AppxProvisionedPackage -Online -PackagePath “$($source)\Sources\Microsoft.ScreenSketch_8wekyb3d8bbwe.appxbundle” –LicensePath “$($source)\Sources\Microsoft.ScreenSketch_8wekyb3d8bbwe.xml”
Copy these .xml and .appxbundle files into the $source folder and run this one-liner script.
Permalink
please help me what to do after writing
dir /s *recenv.exe*
how do I jump to that directory?
Permalink
Simply use “cd” command and copy-paste the target directory where the correct RecEnt.exe can be found.
Permalink
Hi, I have a same problem. I wrote the command in your screeenshot. Now, my CMD screen looks same but I don’t know what I will do after that.. Im not very well on CMD copy paste things. Please help me.. thanks ..
Permalink
Thanks a lot. Its worked. 🙂
Permalink
I’m using a modified ISO and i’m not sure what to do next.
I use solution 1, setup opens, but at the next screen it says “exit and continue install setup” and i get the same error again.
As it comes with solution 2 i’m not sure how to write the first comand
Permalink
Perfect – had this issue before and didn’t know about the source ISO being available at the VLSC. Excellent – saved me a lot of work.
Permalink
It’s now March 2021 and I have just encountered this problem for the first time with a Windows 10 update. Hoping your solution still works. Will give it a go.
Thanks.
Permalink
how use solution 2??? help me
Permalink
I really appreciate your help! Regarding the powershell script can you explain why is necessary the control around flg file if there is a loop to skip the installation if the apps has been already deployed.
Is the flg part of the microsoft internal control, I couldn’t find any created in my template.
Permalink
FLG file is not even necessary. With this, you can just track in which situation has been this missing are reinstalled. Like in MECM a detection rule. It has been deployed for my own use. It’s definitely not from Microsoft.
Permalink
Thanks for clarify! Awesome work.
Permalink
So you know if the solution will support WPA2 Enterprise any time soon?
Permalink
Wireless support generally is a big effort for a relatively small gain. I always recommend using wired setup.
Permalink
Hi,
You can try to add a setupcomplete.cmd script during the winpe phase that runs your OOBE scripts. It will run after reboot, before OOBE but on the real OS.
Or you can change unattend.xml to run the script during OOBE phase.
Permalink
Brilliant idea! Have you managed to kick off oobe scripts this way without manually start oobedeploy? Really like the zti deployment but it would be nice to automatically install netfx and add/ remove appx during OOBE without manually starting the scripts.
Permalink
https://akosbakos.ch/osdcloud-9-oobe-challenges/
😉
Permalink
Hi Erik, so far as I know only these kind of settings can be set during this phase: https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/automate-oobe
Trigger an executable, is for me still unknown. But definitely, it would be a great opportunity to execute the next commands automatically. #CommunityQuestion
Permalink
If i am not mistaken; you can place a C:\Windows\Setup\Scripts\OOBE.cmd file which will get executed post-OOBE. Did not test that yet though…
C:\Setup\Scripts\SetupComplete.cmd will only start after the user sees the desktop…
Permalink
OOBE.cmd location doesn’t matter. I am placing into C:\Windows\System32, because after Shift+F10 I am already in this folder.
Regarding SetupComplete.cmd, it starts before OOBE phase comes up.
Permalink
C:\Windows\Setup\Scripts\OOBE.cmd really is a special location, that file will always run automatically in enterprise/pro editions! See also: https://www.ntlite.com/community/index.php?threads/tutorial-create-perfect-windows-post-setup-using-oobe-cmd.1750/
But it seems to run even before the real OOBE (before the last reboot actually), and thus it has limitations (not all powershell stuff is supported). I am searching for a way to auto-start every script we need in the OOBE phase under the temporary defaultuser0 user. This way the AutopilotOOBE window can popup without having to use Shift+F10 at all.
Permalink
Can you please add some example how to use the PowerShell wrapper which you have created for Surface Drivers Issue. I am facing the same issue and still wanted to use the automated way to deploy the drivers.
I understand that we need to define the $Global variable before launching the Start-OSDCloud command but where we need to use the Powershell Wrapper to define the model?
Permalink
Hi, here we are: https://github.com/AkosBakos/OSDCloud/blob/main/MicrosoftSurfaceDriverIssue.ps1
Permalink
Great articles! Can you please explain these parts…?
When you press Shift-F10, do you have access to Start-OOBEDeploy without doing anything?
And will it just grap C:\ProgramData\OSDeploy\OSDeploy.OOBEDeploy.json if I created that file?
Do you run “iex (irm sandbox.cloudosd.com) ?
Permalink
Hi Henrik, you can put the your scripts together in the OOBE.cmd which you can start after Shift+F10. And yes, OSDeploy.AutopilotOOBE.json and OSDeploy.OOBEDeploy.json are your best friends for the customization.
Nope, running “iex (irm sandbox.osdcloud.com)” is not required.
Permalink
Do you then use an SMB share or web server to host all of your pre-downloaded OS ESDs and Vendor Driver Packs, or does each machine then pull directly from the Internet?
Permalink
‘B’ 😉
We only need to grab the boot file and OSDCloud does his magic afterwards. 🙂
Permalink
Oh, I was hoping you were going to give me the solution to imaging 50 machines at once without blowing through a bunch of Internet data 😉 Why else go through the trouble of using PXE over USB?
Permalink
When you are creating the basic OSD image, you can put the ESD URL in it, which is locating internally.
https://www.osdcloud.com/deploy/wim#findimagefile
Then create the ISO file and “convert” it into a WIM.
Using USB doesn’t require an own network infra (like WDS, PXE VLAN), only the right firewall rules.
Permalink
Thanks. What I’m really after is replicating the offline USB model where I can have many different original ESD files and driver packs cached on an SMB, or better yet, local web server. Then set a variable/global variable to have OSDCloud check there before downloading from the official source.
Permalink
I have a challenge for the community.
For those of you trying to do this all via WiFi, is it possible to automate the connection at the start of OOBE using the WiFi.json file that was created in the WinPE phase.
Relevant code can be found here: https://github.com/OSDeploy/OSD/blob/master/Public/Functions/OSDCloud/Invoke-OSDSpecialize.ps1#L207-L214
Permalink
Hi there,
I’ve tried both methods to generate the WIM from the ISO (DISM and ImageX) – both produce a WIM file but I cannot import them into WDS as a boot image, or an install image – It says not a valid boot image / not a valid install image.
Any ideas?
Thanks
Permalink
Did you check the DISM.log? Was the WIM file created successfully?
Permalink
I checked the DISM Log c:\windows\logs\dism\dism.log and I do see some warnings on every file like this:
2023-06-25 14:18:49, Warning DISM DISM WIM Provider: PID=8052 [AllocNode:(732) -> GetFileStorageTierClass failed] E:\ (HRESULT=0x80070057) – CWimManager::WimProviderMsgLogCallback
[8052] [0x8144012d]
So not sure if the WIM Created correctly
Any ideas?
Permalink
The issue comes when you import the converted WIM file. Please select only the boot.wim file from the ISO (..\sources).
–> I will update this blog post
Permalink
Hey,
Took me a while to get back to this, but yes you’re absolutely right – Mounted the ISO, and extracted the boot.wim from the sources folder.
Added that to WDS and all working perfectly.
Thanks!
Permalink
When and how should i run W11_OOBEcmd.ps1? Is it in Startnet.cmd? Please explain the flow here 🙂
Permalink
Please read this post throw and you can find the answer 😉
https://akosbakos.ch/osdcloud-3-zero-touch-deployment/
One of the keyword here is “StartOSDPad”
Permalink
Hello Ákos,
when I run your W11_OOBEcmd.ps1 in my ScriptPad, the Deployment comes till the AutopilotGUI, but the Register Button don’t work.
In the PS is message that the Button is only active when the defaultuser0 is logged in.
Bernhard
Permalink
Hello Bernhard
In the OOBE phase when you press Shift+F10, you are “automatically” logged in as defaultuser0. So, this Autopilot registration with the register button only works in this phase.
With a simple “whoami”, you can figure out, who you are 😉
Cheers, Ákos
Permalink
Hello Akos
in the OOBE Phase a CMD and a PS Windows open automatically. When i write whoami in the cmd, i get defaultuser0.
The ps scripts are running, the Autopilot GUI opens, but the Register Button don’t work. What I doing wrong? I take your “W11_OOBEcmd.ps1” for testing.
Cheers, Bernhard
Permalink
Hi Bernhard
When you follow my instructions, my guess, that the OOBE scripts are running with SYSTEM credentials (aka. in Session 0). So, the script will skip this part.
When you open a shell, you are with defaultuser0 credential in Session 1.
If you need the register button, you have to work with defaultuser0 and/or you can fully automate this part of the OSD as well:
https://akosbakos.ch/osdcloud-10-full-automation-flow/
Cheers
Permalink
Hello Akos,
I don’t understand this part:
“If you need the register button, you have to work with defaultuser0 and/or you can fully automate this part of the OSD as well”
Do I need to make changes in the scheduled Task,? Both Scheduled Task run from Serviceui.exe.
Do I need to make changes in your “W11_OOBEcmd.ps1” or in your “oobetasks.ps1”
Thanks for your help!!
Cheers
Permalink
When running your ZTI process, I get a warning with Start-AutopilotOOBE : “The register button is disabled when the UserName is not defaultuser0”
I’m unable to click the register button in the GUI
Permalink
If you are running this script via (by me designed) scheduled task, you are SYSTEM at this point & don’t defaultuser0, which the commandlet requires.
Permalink
Hi Akos,
Is there anyway around this at all? Everything is perfect until this point for me.
Permalink
Do you mean triggering the OOBE tasks automatically?
I am using this solution: oobetasks.osdcloud.ch
And in the post below, you can find the SetupComplete.cmd which is creating these scheduled tasks in the specialize phase.
Permalink
Hi again,
This the error I get, as that the OP:
When running your ZTI process, I get a warning with Start-AutopilotOOBE : “The register button is disabled when the UserName is not defaultuser0”
I’m unable to click the register button in the GUI
I used your script that you referenced, everything works apart from the register button not being clickable.
Permalink
Hi Ákos
I have the same problem. But how can I start AutopilotOOBE automatically as defaultuser0? 🙂
Cheers
Wasili
Permalink
Hi
You can try to start the scheduled task as ‘defaultuser0’, either as SYSTEM with ServiceUI.exe.
Or just create a simple CMD into C:\Windows\System32 and click manually Shift+F10. Then you are ‘defaultuser0’ and can execute the previously created batch file.
Cheer,Ákos
Permalink
Did you manage to this working at all? I have the same problem.
Permalink
You have to switch the account in the task scheduler. In my example, the OOBE scripts are running in a SYSTEM context.
I don’t need the register button, because I am working with an offline Autopilot JSON file which is registering and assigning automatically.
Permalink
You have to switch the account in the task scheduler. In my example, the OOBE scripts are running in a SYSTEM context.
I don’t need the register button, because I am working with an offline Autopilot JSON file which is registering and assigning automatically.
Permalink
Hi Akos
Instead of using Task Scheduler, you can add your both scripts “SendKeys” and “OOBE” in local Logonscript folder. (C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logon) In this way AutoPilot registration can be run as “defaultuser0” and the button will be acitv.
Then you have to add some additional “.ini”s.
$psscriptsini = @”
`
[Logon]
0CmdLine=SendKeys.ps1
0Parameters=
1CmdLine=OOBE.ps1
1Parameters=
“@
Out-File -FilePath “C:\WINDOWS\System32\GroupPolicy\User\Scripts\psscripts.ini” -InputObject $psscriptsini -Encoding ascii -Force
$gpt = @”
`[General]
gPCUserExtensionNames=[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B66650-4972-11D1-A7CA-0000F87571E3}]
Version=65536
“@
Out-File -FilePath “C:\WINDOWS\System32\GroupPolicy\gpt.ini” -InputObject $gpt -Encoding ascii -Force
Set-ItemProperty -Path “C:\WINDOWS\System32\GroupPolicy” -Name Attributes -Value ([System.IO.FileAttributes]::Hidden)
Set-ItemProperty -Path “C:\WINDOWS\System32\GroupPolicy\User\Scripts\psscripts.ini” -Name Attributes -Value ([System.IO.FileAttributes]::Hidden)
Permalink
I know this is more static, but if i have local powershell scripts i want to run with SetupComplete, how do i do that? Not having them in uploaded to Github.
Lets say i have three powershell scripts i my WinPE image.
I want to copy them to the C-drive and runt them in OOBE.
Permalink
You already have the solution. 😉
You must just code it, like this:
Copy-Item X:\OSDCloud\Scripts C:\OSDCloud\ -Recurse -Force
$SetupCompleteCMD = @’
powershell.exe -Command Set-ExecutionPolicy RemoteSigned -Force
powershell.exe -File “C:\OSDCloud\xxx.ps1”
‘@
$SetupCompleteCMD | Out-File -FilePath ‘C:\Windows\Setup\Scripts\SetupComplete.cmd’ -Encoding ascii -Force
Permalink
Thanks Akos for the Amazon series on OSSCLOUD, I understand the workflow you are trying to explain in this but just wondering how to call the script in the OOBE phase
I am setup the Zero touch deployment but can’t get my head around what to do next, my company doesn’t allow hosting anything on GitHub so that’s not an option
Any feedback would be appreciated
Permalink
That’s a bit the tricky part. In the specialize phase, two scheduled tasks have been created which are getting triggered in the OOBE phase.
During my solutions, I am always referencing for an online script repository (GitHub/Azure), but these ones can work for sure with local scripts as well. You should import them into the boot.wim and in the WinPE phase care about for the copy job into C:\.
PS: I think we could have here a better and easier way, but so far I am still happy with this solution.
Permalink
Thanks Akos for the tip 😀
I think I can figure that part out
Thanks again for the amazing series
Permalink
Great article,
shouldnt have other Edit-OSDCloudWinPE comands also have the paramter “-WorkspacePath $WorkingDir” added?
Thanks
Permalink
Hi Thomas & thanks 🙂
Here we are: https://github.com/OSDeploy/OSD/blob/master/Docs/Edit-OSDCloudWinPE.md
Permalink
Is there any way to use an included Windows image wim within an ISO?
https://www.osdcloud.com/archive/under-review/wim#findimagefile
Start-OSDCloud -findimagefile
works fine manually, but I cant find a way to automate the run and pre-fill the information.
Thanks
Permalink
You can only use the following parameters in Start-OSDcloud function:
ImageFileFullName = $null
ImageFileItem = $null
ImageFileName = $null
ImageFileSource = $null
ImageFileDestination = $null
ImageFileUrl = $ImageFileUrl
“ImageFileOffline” is not anymore usable as a variable. (so far, as I know)
Permalink
You note that Internet is required, I would disagree. I have everything synced to the flash drive. I can boot to the flash and get to OOBE login fully offline.
Permalink
Thanks Gary for your comment and giving this idea to start an offline process.
Permalink
Hi Akos,
If i run Start-OOBEDeploy in OOBE with Schedule Task and SYSTEM (from you scripts) Start-OOBEDeploy starts running but then quits not updating windows….
If i run it manually from powershell i OOBE it works without any problem. Do you know how to solve this?
Permalink
Hi Johan
Did you check this log file?
$Transcript = “$((Get-Date).ToString(‘yyyy-MM-dd-HHmmss’))-OOBEDeploy.log”
Start-Transcript -Path (Join-Path “$env:SystemRoot\Temp” $Transcript) -ErrorAction Ignore
Do you use a custom JSON file?
$ProgramDataOSDeploy = “$env:ProgramData\OSDeploy”
$JsonPath = “$ProgramDataOSDeploy\OSDeploy.OOBEDeploy.json”
Cheers, Ákos
Permalink
Hi Akos,
just wanted to say many thanks!
I use your sheduled task script and have made various customisations for our company. It has now been working for 2-3 months without a single problem!
Best regards
Benjamin
Permalink
You made my day, Benjamin – much appreciated!
Permalink
Hi Akos,
hope you are doing well. I’ve used the fully automated flow for a few months now. It worked fully at the beginning but right now i have the problem that the scheduled task gets registered, but gets not started until I start it manually or reboot the machine.
Do you know this problem or maybe have an idea which parameters I could change?
Best regards
Benjamin
Permalink
Are the process running, but you are just not seeing (SYSTEM <- -> defaultuser0)? Or they didn’t start at all? You can try to increase the delay. Otherwise wait some days until I post my newest thing about post OOBE tasks… 😉
Permalink
If I were to change settings on the StartOSDCloud GUI, like “Deployment Options”, how would I do that? Thank you.
Permalink
Have a look on that file.
Otherwise, you can find more detailed information here: https://www.osdcloud.com/osdcloud-automate/osdcloudgui-defaults
Permalink
Which directory do I save modified Start-OSDCloudGUI.json file at? The post shows a different workspace structure? I have OSD 24.5.14.1. Thank you for your reply.
Permalink
OSDCloudGUI Configuration File:\OSDCloud\Automate\Default\Start-OSDCloudGUI.json
Autopilot Configuration File:\OSDCloud\ Automate\Default\AutopilotConfigurationFile.json
PowerShell Scripts:\OSDCloud\Automate\Default\Startup\*.ps1 \OSDCloud\Automate\Default\Shutdown\*.ps1
•
•
Provisioning Packages:\OSDCloud\Automate\Default\Provisioning\*.ppkg
Permalink
For any one interested in running a PS Script AUTOMATICALLY right at the start of OOBE here is how do this. I just did for Win 11 Hyper-V VM and it worked
1- Create the Setupcomplete.cmd file using the following
#================================================
# [PostOS] SetupComplete CMD Command Line
#================================================
Write-Host -ForegroundColor Green “Create C:\Windows\Setup\Scripts\SetupComplete.cmd”
$SetupCompleteCMD = @’
powershell.exe -Command Set-ExecutionPolicy RemoteSigned -Force
powershell.exe -Command “& {IEX (IRM oobetasks.osdcloud.ch)}”
‘@
$SetupCompleteCMD | Out-File -FilePath ‘C:\Windows\Setup\Scripts\SetupComplete.cmd’ -Encoding ascii -Force
2- Install Windows System Image Manager as part of ADK (Downlaod ADK from MS official site as an MSI and install the MSI which will put Windows System image manager in your start menu)
3- Open Windows System Image Manager and create a new answer file (unattend.xml)
4- Open your WIM file (if you do not have a WIM file I converted ISO to VHDX then I captured the VHDX into a WIM)
5- Add RunsynchronousCommand to phase 4 which is the specialize phase
6- in the RunsynchronousCommand path add cmd /c C:\Windows\Setup\Scripts\SetupComplete.cmd for the command path so your unattend.xml should look like this
cmd /c C:\Windows\Setup\Scripts\SetupComplete.cmd
1
install autopilot oobe
7- save the unattend.xml at the root of the VHDX or pass it to your ISO/WIM2VHDX script in the unttend.xml parameter here is the script https://raw.githubusercontent.com/x0nn/Convert-WindowsImage/main/Convert-WindowsImage.ps1
8- then create a new Hyper-V and use the VHDX from step 7 as a parent for a differencing disk so that way your VM boot directly into the specialize phase skipping windows install
9- in the specialize phase you will a cmd window pop up which will run the setupcomplete.cmd specified in the unattend.xml specialize phase
10- then the VM will reboot and then come to the OOBE screen and within 15 seconds the scheduled tasks will automatically kick in and start running your PowerShell scripts
the rest is just whatever automation you want
Permalink
So its like your GitHub File?: https://github.com/AkosBakos/OSDCloud/blob/7b28d962e187f9264d6817d209a887ce53d293b2/ScriptPad/W11_simplyfied_OOBE.cmd
I tried it at the script runs before the OOBE phase, the machine reboots and then the normal OOBE is showing up like here (https://i.ibb.co/DVCVRx6/oobe.png). Am I missing something?
Permalink
Any logs in this folder?
$env:ProgramData\Microsoft\IntuneManagementExtension\Logs\OSD\
Permalink
Yes there are this 3 Logfiles:
1) Set-KeyboardLanguage.log
2) Install-EmbeddedProductKey.log
3) Check-AutopilotPrerequisites.log
1 + 2 looks good.
#3 (Check-AutopilotPrerequisites.log)
Shows this in the beginning:
######################################
# Start Autopilot prerequisite check #
######################################
———————————
| Device information |
———————————
Get-ItemPropertyValue : Cannot find path ‘HKLM:\SOFTWARE\Microsoft\Provisioning\AutopilotPolicyCache’ because it does
not exist.
At C:\Program Files\WindowsPowerShell\Scripts\Check-AutopilotPrerequisites.ps1:57 char:23
+ … ilotCache = Get-ItemPropertyValue -Path “HKLM:\SOFTWARE\Microsoft\Pro …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE\…ilotPolicyCache:String) [Get-ItemPropertyValue],
ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand
Get-ItemPropertyValue : Cannot find path ‘HKLM:\SOFTWARE\Microsoft\Provisioning\AutopilotPolicyCache’ because it does
not exist.
At C:\Program Files\WindowsPowerShell\Scripts\Check-AutopilotPrerequisites.ps1:57 char:23
+ … ilotCache = Get-ItemPropertyValue -Path “HKLM:\SOFTWARE\Microsoft\Pro …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE\…ilotPolicyCache:String) [Get-ItemPropertyValue], Item
NotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand
All other tests are good
Permalink
That looks good. Meaning, that the scripts have been executed successfully.
Now you can debug each for these scripts what they are doing wrong and/or which scripts you really need in this phase.
Permalink
I have the oobe.cmd placed in the Setup\Script folder, after OCD does its thing it boots up to the AutopilotOOBE Gui but you can’t click the Register button as it states that it needs to run as default0 user which does not exist. If I put the oobe.cmd somewhere else and use Shift/F10 and run it manually it works just fine. I must be missing something as I thought it would trigger the Gui automatically and be able to register
Permalink
Nope, you are right: executing OOBE.cmd like this blog post said, we are SYSTEM.
If you (manually) click Shift+F10, we are DefaultUserX.
You can automate the AutopilotOOBE part with the well-known Get-WindowsAutopilotInfo and/or with the Get-WindowsAutopilotInfoCOMMUNITY version.
Permalink
If you look at the Get-WindowsAutopilotInfo scriot, you realize that there is only a couple of infos you need. Get the hash, get the serial and the product key (empty) and use a group tag. With this infos you will be able to automate the registration using an Azure Function. No GUI or user interacton at all.
Permalink
Hi Akos,
You still have to run oobe.cmd from SetupComplete.cmd correct?
Or do you mean that you can put other .cmd files in the Scripts folder and those files will also run?
Permalink
Hi Johan,
these two scripts are complete separately.
First, the SetupComplete.cmd will be executed and in the next OSD stage comes the OOBE.cmd.