2018-11-15 16:47:17

还原window自带app

复制以下代码再powershell运行


# Get all the provisioned packages
$Packages = (get-item 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications') | Get-ChildItem

<!--more-->
# 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"
    }as
}

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
}

本文链接:https://blog.zxysilent.com/post/restore-win10-apps.html

-- EOF --

Comments