No Comments










  1. Hi, is this also possible in hybrid (Intune via SCCM)?

    Reply

    1. Hallo Mike, for sure.
      Same configs are available in SCCM console as well.

      Reply

  2. 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! 🙂

    Reply

    1. Oana, thanks for your nice words.
      And thanks again for working together to solve my issue.

      Reply

    1. Solution 2, are they command or? how did you do it?

      Reply

  3. I got “‘cpi’ is not recognized as an internal or external command,
    operable program or batch file. error.” Can you help please?

    Reply

    1. You can use Copy-Item, Copy or CP as standard aliases too.

      Reply

      1. 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?

        Reply

  4. Solution1 works like a charm – many thx

    Reply

  5. Thanks so much, this saved my bacon!!

    Reply

  6. 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.

    Reply

    1. This ISO contains these required files too. You can just use the same one-line script for the installation as well.

      Reply

  7. 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

    Reply

  8. 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 !

    Reply

  9. 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

    Reply

  10. Hi,

    We succesfully restored the Mail and Calender app by your guide.

    Great article!

    Thank you!

    Reply

      1. 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.

        Reply

        1. 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.

          Reply

  11. You’re a lifesaver!

    Excellent guide!

    Reply

  12. 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?

    Reply

    1. For these Appx’s (Microsoft.NET.Native.Runtime* and Microsoft.VCLibs*) you don’t need the licensepath parameter. Either use -SkipLicense!

      Reply

  13. thanks for this, we accidentally uninstalled it 🙂

    Reply

  14. I am getting “Add-AppxProvisionedPackage : Element not found.” when I run the command

    any idea what could be the issue ?

    Reply

    1. Maybe, because that is not the version that applies to your W10 build.

      Reply

      1. 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.

        Reply

        1. For Calculator, Alarms or StickyNotes, you could simply redeploy the AppX:
          Get-AppxPackage -allusers *windowscalculator* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}

          Reply

          1. 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.


          2. 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


          3. no it will not if you have deleted that app for all users or deleted the provisionalpackage.


  15. that worked!
    thanks for the info!

    Reply

      1. What do i have to type in cmd to run the file?

        Reply

        1. powershell.exe -command “& {Add-AppxProvisionedPackage -Online -PackagePath “X:\x86fre\Microsoft.WindowsStore_8wekyb3d8bbwe.appxbundle” –LicensePath “X:\x86fre\Microsoft.WindowsStore_8wekyb3d8bbwe.xml”}”

          Reply

  16. 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!

    Reply

  17. Thanks for this tip, I was able to restore Microsoft Photos on my master image!

    Reply

  18. 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

    Reply

    1. why you even tried to install provisionedpackage if you already had that app in your machine?

      Reply

  19. Thank you!!! Thank you!!! Thank you!!! Searched for HOURS and finally stumbled upon your recommendation and it worked like a champ!

    Reply

  20. How i download Windows 10 Inbox Apps without VLSC?

    Reply

  21. 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!!

    Reply

  22. 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!

    Reply

  23. Hi I don’t have VLSC, is there another way to get the iso? Or maybe use the “normal” iso?

    Reply

    1. 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.

      Reply

  24. 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.

    Reply

  25. 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 😉

    Reply

    1. 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. 😉

      Reply

  26. 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!

    Reply

  27. 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?

    Reply

    1. 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.

      Reply

  28. 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

    Reply

    1. You can use the same appbundle’s for other versions too.

      Reply

      1. 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?

        Reply

        1. ‘kill -n explorer’ already tried?

          Reply

          1. No, I haven’t tried this. What would this achieve?


          2. 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.


          3. Check the latest blog update (script). Hope it helps you.


  29. What do I do after the first solution, do I wait or do a command, please help me.

    Reply

    1. Hi Jack, try to run this newly founded RecEnv.exe; with the correct path.

      Reply

      1. What does that mean, im sorry im not that tech person that knows everything, could you explain it to me please.

        Reply

        1. Which kind of W10 editions do you have? Home, Pro or Enterprise?
          In which phase do you have this issue? OSD setup, feature upgrade?

          Reply

          1. I believed I had a Pro Edition, or a home. I haven’t checked but I think i have pro.


  30. 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.

    Reply

  31. 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.

    Reply

  32. 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?

    Reply

  33. Hi for solution 1 ..it says file not found.

    Reply

  34. 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

    Reply

    1. Maybe it’s a “hidden” AppLocker policy? Check quickly in Event viewer

      Reply

      1. 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

        Reply

  35. When I try to launch Microsoft Store, this log appeared.

    Event Name: AppxDeploymentFailureBlue

    Source: Windows Error Reporting
    Event ID:1001
    Level: Information

    Reply

  36. 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

    Reply

    1. 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.

      Reply

  37. please help me what to do after writing
    dir /s *recenv.exe*
    how do I jump to that directory?

    Reply

    1. Simply use “cd” command and copy-paste the target directory where the correct RecEnt.exe can be found.

      Reply

  38. 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 ..

    Reply

  39. 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

    Reply

  40. 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.

    Reply

  41. 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.

    Reply

  42. 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.

    Reply

    1. 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.

      Reply

  43. So you know if the solution will support WPA2 Enterprise any time soon?

    Reply

    1. Wireless support generally is a big effort for a relatively small gain. I always recommend using wired setup.

      Reply

  44. 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.

    Reply

    1. 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.

      Reply

    1. 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…

      Reply

      1. 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.

        Reply

  45. 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.

    Reply

  46. 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?

    Reply

  47. 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) ?

    Reply

    1. 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.

      Reply

  48. 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?

    Reply

    1. ‘B’ 😉
      We only need to grab the boot file and OSDCloud does his magic afterwards. 🙂

      Reply

      1. 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?

        Reply

        1. 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.

          Reply

          1. 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.


  49. 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

    Reply

    1. Did you check the DISM.log? Was the WIM file created successfully?

      Reply

      1. 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?

        Reply

        1. 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

          Reply

          1. 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!


  50. When and how should i run W11_OOBEcmd.ps1? Is it in Startnet.cmd? Please explain the flow here 🙂

    Reply

  51. 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

    Reply

    1. 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

      Reply

  52. 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

    Reply

    1. 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

      Reply

  53. 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

    Reply

  54. 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

    Reply

    1. 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.

      Reply

      1. Hi Akos,

        Is there anyway around this at all? Everything is perfect until this point for me.

        Reply

        1. 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.

          Reply

          1. 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.


  55. Hi Ákos

    I have the same problem. But how can I start AutopilotOOBE automatically as defaultuser0? 🙂

    Cheers
    Wasili

    Reply

    1. 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

      Reply

    2. Did you manage to this working at all? I have the same problem.

      Reply

      1. 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.

        Reply

      2. 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.

        Reply

  56. 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)

    Reply

  57. 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.

    Reply

    1. 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

      Reply

  58. 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

    Reply

    1. 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.

      Reply

      1. Thanks Akos for the tip 😀

        I think I can figure that part out

        Thanks again for the amazing series

        Reply

  59. Great article,

    shouldnt have other Edit-OSDCloudWinPE comands also have the paramter “-WorkspacePath $WorkingDir” added?

    Thanks

    Reply

    1. 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)

      Reply

  60. 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.

    Reply

    1. Thanks Gary for your comment and giving this idea to start an offline process.

      Reply

  61. 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?

    Reply

    1. 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

      Reply

  62. 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

    Reply

    1. You made my day, Benjamin – much appreciated!

      Reply

  63. 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

    Reply

    1. 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… 😉

      Reply

Comments are closed.