Skip to content

Instantly share code, notes, and snippets.

@crowbarsolutions
Created August 16, 2015 18:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save crowbarsolutions/3234283438e3a6c8c574 to your computer and use it in GitHub Desktop.
Save crowbarsolutions/3234283438e3a6c8c574 to your computer and use it in GitHub Desktop.
# Get all the provisioned packages
$Packages = (get-item 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications') | Get-ChildItem
# Filter the list if provided a filter
$PackageFilter = $args[0]
if ([string]::IsNullOrEmpty($PackageFilter))
{
echo "No filter specified, attempting to re-register all provisioned apps."
}
else
{
$Packages = $Packages | where {$_.Name -like $PackageFilter}
if ($Packages -eq $null)
{
echo "No provisioned apps match the specified filter."
exit
}
else
{
echo "Registering the provisioned apps that match $PackageFilter"
}
}
ForEach($Package in $Packages)
{
# get package name & path
$PackageName = $Package | Get-ItemProperty | Select-Object -ExpandProperty PSChildName
$PackagePath = [System.Environment]::ExpandEnvironmentVariables(($Package | Get-ItemProperty | Select-Object -ExpandProperty Path))
# register the package
echo "Attempting to register package: $PackageName"
Add-AppxPackage -register $PackagePath -DisableDevelopmentMode
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment