powershell - For loop with DISM to remove unwanted applications in Windows 10 -
i having trouble below script. although says successful during run-time, applications still present within os. dism log files not helpful either.
# remove non-corporate apps $appslist = "microsoft.3dbuilder",` "microsoft.advertising.xaml",` "microsoft.messaging",` "microsoft.microsoft3dviewer",` "microsoft.messaging",` "microsoft.microsoftofficehub",` "microsoft.microsoftsolitairecollection",` "microsoft.office.onenote",` "microsoft.oneconnect",` "microsoft.people",` "microsoft.skypeapp",` #"microsoft.storepurchaseapp",` "microsoft.wallet",` "microsoft.xboxapp",` "microsoft.xboxgameoverlay",` "microsoft.xboxidentityprovider",` "microsoft.xboxspeechtotextoverlay",` "microsoft.zunemusic",` "microsoft.zunevideo",` #"microsoft.windowsstore",` "microsoft.windowscommunicationsapps",` "microsoft.windowsphone",` "microsoft.office.sway",` "microsoft.connectivitystore",` "microsoft.commsphone",` "microsoft.bingfinance" foreach ($app in $appslist){ $variable = dism /online /get-provisionedappxpackages | select-string packagename $variable2 = $variable -replace "packagename : ", "" } $variable2| % {dism /online /remove-provisionedappxpackage /packagename:$_}
to remove apps current user:
foreach ($app in $appslist) { get-appxpackage -name $app | remove-appxpackage }
to remove apps new users logging onto system use, not remove existing users:
foreach ($app in $appslist) { get-appxprovisionedpackage -online | where-object { $_.displayname -eq $app } | remove-appxprovisionedpackage -online }
Comments
Post a Comment