RehabCZ

W10 | Reinstall store apps

May 24th, 2024
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 1.04 KB | Source Code | 0 0
  1. # Get all the provisioned packages
  2. $Packages = (get-item 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications') | Get-ChildItem
  3.  
  4. # Filter the list if provided a filter
  5. $PackageFilter = $args[0]
  6. if ([string]::IsNullOrEmpty($PackageFilter))
  7. {
  8.     echo "No filter specified, attempting to re-register all provisioned apps."
  9. }
  10. else
  11. {
  12.     $Packages = $Packages | where {$_.Name -like $PackageFilter}
  13.  
  14.     if ($Packages -eq $null)
  15.     {
  16.         echo "No provisioned apps match the specified filter."
  17.         exit
  18.     }
  19.     else
  20.     {
  21.         echo "Registering the provisioned apps that match $PackageFilter"
  22.     }
  23. }
  24.  
  25. ForEach($Package in $Packages)
  26. {
  27.     # get package name & path
  28.     $PackageName = $Package | Get-ItemProperty | Select-Object -ExpandProperty PSChildName
  29.     $PackagePath = [System.Environment]::ExpandEnvironmentVariables(($Package | Get-ItemProperty | Select-Object -ExpandProperty Path))
  30.  
  31.     # register the package 
  32.     echo "Attempting to register package: $PackageName"
  33.  
  34.     Add-AppxPackage -register $PackagePath -DisableDevelopmentMode
  35. }
  36.  
  37.  
Add Comment
Please, Sign In to add comment