{"id":2635,"date":"2017-08-27T21:32:13","date_gmt":"2017-08-27T19:32:13","guid":{"rendered":"http:\/\/blog.hosebei.ch\/?p=2635"},"modified":"2017-08-27T21:32:13","modified_gmt":"2017-08-27T19:32:13","slug":"windows-10-1703-remove-universal-windows-platform-uwp-apps","status":"publish","type":"post","link":"https:\/\/blog.hosebei.ch\/?p=2635","title":{"rendered":"Windows 10 1703 &#8211; Remove Universal Windows Platform (UWP) Apps"},"content":{"rendered":"<p><strong>DON&#8217;T Do THIS! Use AppLocker instead! Do not remove any apps from the image<\/strong><\/p>\n<p>Hi reader,<\/p>\n<p>I would like to share my script to remove windows universal apps, which I have tried to make it simple as possible.<br \/>\nFirst let me explain, that there seems to exist two different types of Apps which reside within the Windows 10 Image. You can list them with Get-AppxPackage and Get-AppxProvisionedPackage (you need <strong>Administrator<\/strong> permission to do so):<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps01.png?w=300\" alt=\"\" width=\"300\" height=\"247\" \/><\/a> <a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps021.png\"><img decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps021.png?w=300\" alt=\"\" \/><\/a><br \/>\n<!--more--><\/p>\n<p>And both of those Apps require a different Powershell command to remove the App. For the provisioned UWP Apps, you need to use Remove-AppxProvisionedPackage (<a href=\"https:\/\/technet.microsoft.com\/en-us\/itpro\/powershell\/windows\/dism\/remove-appxprovisionedpackage\" target=\"_blank\" rel=\"noopener\">Technet Source<\/a>). The other UWP Apps can be removed with Remove-AppxPackage (<a href=\"https:\/\/technet.microsoft.com\/en-us\/itpro\/powershell\/windows\/appx\/remove-appxpackage\" target=\"_blank\" rel=\"noopener\">TechNet Source<\/a>).<\/p>\n<p>This was leading me to create a Powershell Script, where you can easily create Output Files of the Apps. Afterwards you can edit the output files, and use them as Input File to remove the apps from the system.<br \/>\nThe following command is required, to export the provisoned Apps:<br \/>\n<code>.\\ManageUWPApps.ps1 -ScriptFunction Export<\/code><br \/>\nThe Script will generate a csv called ProvisionedApps.txt where the powershell Script resides, unless you had defined the parameter -Workfile (See Script Description for more Information).<br \/>\nYou can then delete all the Apps, which should reside on the system, and only include Apps, which should get removed. In the following example, only OneNote and the Wallet gets removed:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-2639\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps03.png?w=300\" alt=\"\" width=\"300\" height=\"53\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps03.png 794w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps03-300x53.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2017\/08\/removeuwpapps03-768x134.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To remove the provisioned Apps within the csv, you have to start the Script with different parameters:<br \/>\n<code>.\\ManageUWPApps.ps1 -ScriptFunction RemoveApps -WorkFile 'C:\\temp\\ProvisionedApps.txt'<\/code><\/p>\n<p>For the other apps, to export you need to use ExportApps:<br \/>\n<code>.\\ManageUWPApps.ps1 -ScriptFunction ExportApps<\/code><br \/>\nThis will create an output file named AllOtherApps.txt, unless specified with the Workfile parameter.<\/p>\n<p>To remove the Apps, edit the exported List as above, and use the File as import file within the following command:<br \/>\n<code>.\\ManageUWPApps.ps1 -ScriptFunction RemoveOtherApps -WorkFile 'C:\\temp\\AllOtherApps.txt'<\/code><\/p>\n<p>You can download the Script from my OneDrive, or you can try copy\/paste from blog (be aware of special Chars) at the end of this blog.<br \/>\nDownload Link txt: https:\/\/1drv.ms\/t\/s!Aq0GcVCqC0Rlor0FIqoDPUF2ghrbrA<\/p>\n<p>Hope this helps.<\/p>\n<p>The Script:<br \/>\n<code># Description<br \/>\n#-&gt; For Exports: Existing Files with same Name will be overwritten!<\/code><\/p>\n<p># Export Examples:<br \/>\n# .\\ManageUWPApps.ps1 -ScriptFunction Export<br \/>\n# -&gt; This will export the provisioned Apps to a CSV File located where the Powershell Script resides, at it will overwrite an existent File named ProvisionedApps.txt<br \/>\n#<br \/>\n# .\\ManageUWPApps.ps1 -ScriptFunction Export -WorkFile c:\\temp\\11111.txt<br \/>\n# -&gt; This will export the provisioned Apps to a CSV File located at c:\\temp\\11111.txt, at it will overwrite an existent File<br \/>\n#<br \/>\n# The paramter switch &#8220;ExportApps&#8221; works as above<br \/>\n# .\\ManageUWPApps.ps1 -ScriptFunction ExportApps<br \/>\n# -&gt; This will export the other Apps to a CSV File located where the Powershell Script resides, at it will overwrite an existent File named AllOtherApps.txt<\/p>\n<p># Remove Apps Examples<br \/>\n# .\\ManageUWPApps.ps1 -ScriptFunction RemoveApps -WorkFile &#8216;C:\\temp\\ProvisionedAppx.txt&#8217;<br \/>\n# -&gt; This will remove all provisioned Apps which reside in the omitted text file (same layout as export required!)<br \/>\n#<br \/>\n# .\\ManageUWPApps.ps1 -ScriptFunction RemoveOtherApps -WorkFile &#8216;C:\\temp\\AllOtherApps.txt&#8217;<br \/>\n# -&gt; This will remove all other Apps which reside in the omitted text file (same layout as export required!)<\/p>\n<p>#See blog: https:\/\/blog.hosebei.ch to be created \ud83d\ude42<\/p>\n<p>#### Require Parameters<\/p>\n<p>#Force to use Selection of Execution<br \/>\nParam(<br \/>\n[Parameter(mandatory=$true)][string]$ScriptFunction,<br \/>\n[string]$WorkFile<br \/>\n)<\/p>\n<p>#### Functions<\/p>\n<p>#Create OutPutFile Function<br \/>\nFunction Create-OutPutFile {<br \/>\nParam(<br \/>\n[string]$OutPutFile<br \/>\n)<\/p>\n<p>if($OutPutFile -eq &#8220;&#8221;) {<br \/>\nWrite-Error &#8220;No OutpuFile Name was ommited or generated. Script aborted&#8221;<br \/>\nexit(1)<br \/>\n}<\/p>\n<p>#Export Provisioned Apps<br \/>\n$apps = Get-AppxProvisionedPackage -Online | select DisplayName,PackageName<br \/>\n#Delete Export File if already existent<br \/>\nif(Test-Path $OutPutFile) {<br \/>\nRemove-Item $OutPutFile -Force<br \/>\n}<br \/>\n$apps | export-csv -Path $OutPutFile -Delimiter &#8220;,&#8221; -NoTypeInformation<\/p>\n<p>}<\/p>\n<p>#Creat Export file for Apps<br \/>\nFunction Create-OutPutFileApps {<br \/>\nParam(<br \/>\n[string]$OutPutFile<br \/>\n)<\/p>\n<p>if($OutPutFile -eq &#8220;&#8221;) {<br \/>\nWrite-Error &#8220;No OutpuFile Name was ommited or generated. Script aborted&#8221;<br \/>\nexit(4)<br \/>\n}<\/p>\n<p>#Export Provisioned Apps<br \/>\n$apps = Get-AppxPackage -AllUsers | select Name,PackageFullName<br \/>\n#Delete Export File if already existent<br \/>\nif(Test-Path $OutPutFile) {<br \/>\nRemove-Item $OutPutFile -Force<br \/>\n}<br \/>\n$apps | export-csv -Path $OutPutFile -Delimiter &#8220;,&#8221; -NoTypeInformation<\/p>\n<p>}<\/p>\n<p>#Remove Provisionied Apps Function<br \/>\nFunction Remove-ProvisionedApps {<\/p>\n<p>Param(<br \/>\n[string]$InPutFile<br \/>\n)<\/p>\n<p>if(Test-Path $InPutFile) {<br \/>\n$workfile = $InPutFile<br \/>\n}<br \/>\nelse {<br \/>\nWrite-Warning &#8220;Input File was not accessible! The following file name was tried:&#8221;<br \/>\nWrite-Warning $InPutFile<br \/>\nexit(3)<br \/>\n}<\/p>\n<p>#read input file<br \/>\n$AppsToRemove = import-csv -Path $workfile -Delimiter &#8220;,&#8221;<\/p>\n<p>#execute appx removal<br \/>\nforeach($appToRemove in $AppsToRemove){<\/p>\n<p>Write-Host (&#8220;The following app will be removed: &#8221; + $appToRemove.DisplayName)<br \/>\nRemove-AppxProvisionedPackage -Online -AllUsers -PackageName $appToRemove.PackageName<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>Function Remove-AllOtherApps {<br \/>\nParam(<br \/>\n[string]$InPutFile<br \/>\n)<\/p>\n<p>if(Test-Path $InPutFile) {<br \/>\n$workfile = $InPutFile<br \/>\n}<br \/>\nelse {<br \/>\nWrite-Warning &#8220;Input File was not accessible! The following file name was tried:&#8221;<br \/>\nWrite-Warning $InPutFile<br \/>\nexit(7)<br \/>\n}<\/p>\n<p>#read input file<br \/>\n$AppsToRemove = import-csv -Path $workfile -Delimiter &#8220;,&#8221;<\/p>\n<p>#execute appx removal<br \/>\nforeach($appToRemove in $AppsToRemove){<\/p>\n<p>Write-Host (&#8220;The following app will be removed: &#8221; + $appToRemove.Name)<br \/>\nRemove-AppxPackage -AllUsers -Package $appToRemove.PackageFullName<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>#### Main Script<\/p>\n<p>#Main Script Switch Section<br \/>\nswitch ($ScriptFunction) {<\/p>\n<p>&#8220;Export&#8221; {<br \/>\n#Check if WorkFile was defined<br \/>\nif($WorkFile -eq &#8220;&#8221;) {<br \/>\n#Generate Workfile Path<br \/>\n$WorkFile = $PSScriptRoot + &#8220;\\ProvisionedApps.txt&#8221;<\/p>\n<p>}<br \/>\n#Start Export<br \/>\nCreate-OutPutFile -OutPutFile $WorkFile<br \/>\n}<\/p>\n<p>&#8220;ExportApps&#8221; {<br \/>\n#Check if WorkFile was defined<br \/>\nif($WorkFile -eq &#8220;&#8221;) {<br \/>\n#Generate Workfile Path<br \/>\n$WorkFile = $PSScriptRoot + &#8220;\\AllOtherApps.txt&#8221;<\/p>\n<p>}<br \/>\n#Start Export<br \/>\nCreate-OutPutFileApps -OutPutFile $WorkFile<br \/>\n}<\/p>\n<p>&#8220;RemoveApps&#8221; {<br \/>\n#Check for Input File<br \/>\nif($WorkFile -eq &#8220;&#8221;) {<br \/>\n#Generate Workfile Path<br \/>\nWrite-Warning &#8220;You must provide the InputFile Path when removing provosionied apps!&#8221;<br \/>\nWrite-Warning &#8220;Example: ManageUWPApps.ps1 -ScriptFunction RemoveApps -WorkFile &#8216;C:\\temp\\ProvisionedAppx.txt'&#8221;<br \/>\nexit(2)<\/p>\n<p>}<br \/>\nelse {<br \/>\nRemove-ProvisionedApps -InPutFile $WorkFile<br \/>\n}<\/p>\n<p>}<\/p>\n<p>&#8220;RemoveOtherApps&#8221; {<br \/>\n#Check for Input File<br \/>\nif($WorkFile -eq &#8220;&#8221;) {<br \/>\n#Generate Workfile Path<br \/>\nWrite-Warning &#8220;You must provide the InputFile Path when removing provosionied apps!&#8221;<br \/>\nWrite-Warning &#8220;Example: ManageUWPApps.ps1 -ScriptFunction RemoveOtherApps -WorkFile &#8216;C:\\temp\\AllOtherAppx.txt'&#8221;<br \/>\nexit(6)<\/p>\n<p>}<br \/>\nelse {<br \/>\nRemove-AllOtherApps -InPutFile $WorkFile<br \/>\n}<\/p>\n<p>}<\/p>\n<p>default {write-host &#8220;See description at top of the script, and\/or visit my blog&#8221;}<\/p>\n<p>}<br \/>\n<code><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>DON&#8217;T Do THIS! Use AppLocker instead! Do not remove any apps from the image Hi reader, I would like to share my script to remove windows universal apps, which I have tried to make it simple as possible. First let me explain, that there seems to exist two different types of Apps which reside within [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,27,28,43],"tags":[],"class_list":["post-2635","post","type-post","status-publish","format-standard","hentry","category-application-management","category-operating-system-deployment","category-packaging","category-windows-10"],"_links":{"self":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/2635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2635"}],"version-history":[{"count":0,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/2635\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}