添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

UPDATE, 14.09.2020:

I’ve got lot’s of comment to this blog post where people have still some issues to deploy AppX’s. So I would like to extend this post here with my script how I solved it on the customer site.

We have to care of two things:

  • this script has to execute in the user session,
  • it has to run when the .flg mark file ( %LOCALAPPDATA%\ClientLog\Appx_Installflag_%VAR_AlarmsVersion%.flg ) doesn’t exist.
  • # Reinstall Microsoft.WindowsAlarms_10.1706.2401.0_x64__8wekyb3d8bbwe
    $appname = "Microsoft.WindowsAlarms_10.1706.2401.0_x64__8wekyb3d8bbwe"
    $apppath = "C:\Program Files\WindowsApps\Microsoft.WindowsAlarms_10.1706.2401.0_x64__8wekyb3d8bbwe\appxmanifest.xml"
    $date = Get-Date -Format "yyyyMMdd-hhmmss"
    $logdate = Get-Date -Format "yyyy-MM-dd hh:mm:ss"
    $flgpath = Join-Path $env:LOCALAPPDATA\"ClientLog" "Appx_Installflag_$appname.flg"
    $logpath = "C:\Client\Logs\" + $date + "-W10_1709_Appx_Installlog_$appname" + "_$env:username.log"
    # Region LogInfo
        Function LogInfo([string] $sBuf) {
            if($sBuf.ToLower().Contains("error") -or $sBuf.ToLower().Contains("warning"))
                Write-Host $sBuf -ForegroundColor Red
                Write-Host $sBuf -ForegroundColor Magenta
            If ($LogResults) {
                $sDateTime = Get-Date -UFormat "%Y-%m-%d %H:%M:%S"
                $sDateTime + " > " + $sBuf | Out-File -FilePath $logFile -Append
    # Start Logging
    Start-Transcript $logpath
    # Redeploy App
    if ((Get-AppxPackage).PackageFullName -eq $appname)
        LogInfo("$logdate > $appname already deployed")
    } else {
        LogInfo("$logdate > $appname not found")
        LogInfo("$logdate > Starting deployment of $appname")
        Add-AppxPackage -register $apppath -DisableDevelopmentMode
        LogInfo("$logdate > Deployment completed")
    # App Deployment Status Query
    if ((Get-AppxPackage).PackageFullName -eq $appname)
        LogInfo("$logdate > $appname found")
        Get-AppxPackage $appname
        New-Item -ItemType File -Path $flgpath | Out-Null
        LogInfo("$logdate > .flg File created")
        LogInfo("$logdate > $appname successful deployed - DONE!")
        Stop-Transcript
    } else {
        LogInfo("$logdate > $appname not found")
        LogInfo("$logdate > $appname deployment not successful - stopping Script")
        Stop-Transcript
    

    ################################################

    I had previosly an interesting use case at the customer, I had to reinstall a built-in application on a Windwos 10 client :

  • Windows Store app has been removed in the post OOBE phase when W10 v1709 has been installed. After the W10 v1803 upgrade process, this application won’t be installed (again) automatically.
  • If you remove these kind of built-in applications to “early” during the OS installation phase or even during the upgrade, it’s not so easy to reinstall again.

    Microsoft comments especially this Windows Store use case so:
    The Store app can’t be removed. If you want to remove and reinstall the Store app, you can only bring Store back by either restoring your system from a backup or resetting your system. Instead of removing the Store app, you should use group policies to hide or disable it.
    I read lot’s of articles about solutions and workarounds like:

  • Just run the following PowerShell commands:
    Add-AppxPackage -DisableDevelopmentMode -Register “C:\Program Files\WindowsApps\Microsoft.WindowsStore_11606.1001.39.0_x64__8wekyb3d8bbwe\AppXManifest.xml”
    Add-AppxPackage -DisableDevelopmentMode -Register “C:\Program Files\WindowsApps\Microsoft.WindowsStore_11606.1001.394.0_neutral_~_8wekyb3d8bbwe\AppxMetadata\AppxBundleManifest.xml”
  • If you wish to reinstall Windows 10 Store, you can also open an elevated PowerShell windows, type the following command and hit Enter:
    Get-AppXPackage *WindowsStore* -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}
  • These commands could work for sure, if ‘only’ as AppXPackage will be removed. But if these apps will never be provisioned, it won’t work, like in my case.

    That’s why I had to find another solution: Microsoft has an ISO on VLSC (search for “Windows 10 Inbox Apps“) containing all of the pre-installed apps. Download this ISO and use these source files.

    IMPORTANT: be careful, these ISO are depending on your Windows 10 versions. Download and use the correct one.

    The ISO also contains the ‘NET.Native‘ and ‘VCLibs‘ appx files, they should be required for the Windows Store installation.

    My one-line PS script to reinstall the Windows Store app looks very simple:

    Add-AppxProvisionedPackage -Online -PackagePath "X:\x86fre\Microsoft.WindowsStore_8wekyb3d8bbwe.appxbundle" –LicensePath "X:\x86fre\Microsoft.WindowsStore_8wekyb3d8bbwe.xml"

    Note that the this command can reinstall not just the Store app but also all other default apps that ship with Windows 10 which have been removed for some reason.

    Just let me know in comments, if is works for you too…

    Happy reinstalling respectively re-engineering 🙂

    Posted in , , , , , , ,

    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

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

    Reply

    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

    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

    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

    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

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

    Reply

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

    any idea what could be the issue ?

    Reply

    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

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

    Reply

    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

    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

    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

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

    Reply

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

    Reply

    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

    Reply

    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

    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

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

    Reply

    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

    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

    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

    Reply

    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

    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

    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

    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

    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

    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

    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

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

    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

    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

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

    Event Name: AppxDeploymentFailureBlue

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

    Reply

    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
    Reply

    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

    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

    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

    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

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *