一顿baidu,下面的命令好像好使
Get-WindowsCapability -Online | Where-Object { $_.State -eq "Installed" } | Sort-Object | Foreach { Write-Host "CapabilityName: " -NoNewline; Write-Host $_.Name; Add-WindowsCapability -Online -name $_.Name }
Get-WindowsOptionalFeature -Online | Where-Object { $_.State -eq "Enabled" } | Sort-Object | Foreach { Write-Host "FeatureName : " -NoNewline; Write-Host $_.FeatureName; Enable-WindowsOptionalFeature -Online -FeatureName $_.FeatureName }
Get-AppXPackage -AllUsers | Sort-Object | Foreach {Write-Host "Name : " -NoNewline; Write-Host $_.Name; Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}