title: Removing Windows 10 Apps with Powershell Script
body: <p>I have a script that lists Windows 10 Apps to the user, and the user can select an app from the list, and it will remove the app. This is where I started from: <a href="http://www.tenforums.com/tutorials/4689-apps-uninstall-windows-10-a.html#option3" rel="nofollow">Uninstall Windows 10 Apps</a>.</p>
  
  <p>My Code:</p>
  
  <pre><code>$appArray = @("3dbuilder", "windowsalarms", "Appconnector", "windowscalculator", "windowscommunicationsapps", "windowscamera", "CandyCrushSaga",
                "officehub", "skypeapp", "getstarted","zunemusic", "windowsmaps", "Messaging", "solitairecollection", "ConnectivityStore", "bingfinance",
                "zunevideo", "bingnews", "onenote", "people", "CommsPhone", "windowsphone", "photos", "WindowsScan", "bingsports", "windowsstore",
                "Office.Sway", "Twitter", "soundrecord", "bingweather", "xboxapp", "XboxOneSmartGlass")
  $appNames = @("3D Builder", "Alarms &amp; Clock", "App Connector", "Calculator", "Calendar and Mail", "Camera", "Candy Crush Saga", "Get Office", "Get Skype", 
                "Get Started", "Groove Music", "Maps", "Messaging", "Microsoft Solitaire Collection", "Microsoft Wi-Fi", "Money", "Movie &amp; TV", "News", 
                "OneNote", "People", "Phone", "Phone Companion", "Photos", "Scan", "Sports", "Store (Not Recommended)", "Sway", "Twitter", "Voice Recorder", 
                "Weather", "Xbox", "Xbox One SmartGlass")
  
  Do{
      $index = 1;
  
      Write-Host "Select An Option Below to Uninstall...`n"
  
      foreach ($app in $appNames){
          Write-Host "'$index': $app"
          $index++
      }
  
      Write-Host "'0': Exit"
  
      Write-Host "`n"
      $userOption = Read-Host -Prompt "Option: "
  
      if($userOption -gt 0){
  
          $appOption = $userOption - 1
  
          Get-appxpackage -allusers | where-object {$_.packagefullname -like "*$appArray[$appOption]*"} | remove-appxpackage
          Get-appxprovisionedpackage –online | where-object {$_.packagefullname –like "*$appArray[$appOption]*"} | remove-appxprovisionedpackage –online
  
          $appList = Get-appxpackage -allusers | where-object {$_.packagename -like "*$appArray[$appOption]*"}
  
          Write-Host "'$appList'"
  
          $userOption = 0
      }
  
  }While($userOption -ne 0)
  
  
  Write-Host "Exiting Script..."
  </code></pre>
  
  <p>The Problem:</p>
  
  <p>The script runs without an error, but then none of the apps get removed. I added in these lines to see what the app it finds is, but it comes out as an empty string.</p>
  
  <pre><code>$appList = Get-appxpackage -allusers | where-object {$_.packagename -like "*$appArray[$appOption]*"}
  Write-Host "'$appList'"
  </code></pre>
  
  <p>An example result would look like so:</p>
  
  <blockquote>
    <p>Option: : 1<br>
    ''<br>
    Exiting Script...</p>
  </blockquote>