Removing App Packages

Discussion in 'Windows 10' started by SightUp, Nov 3, 2017.

  1. SightUp

    SightUp MDL Senior Member

    Aug 17, 2010
    259
    12
    10
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowsalarms*"} | remove-appxprovisionedpackage –online"


    I am trying to get this to work in a .bat file. What am I doing wrong? I am told that it needs to use the Elevated PS? I don't know. I am running it in admin and it's not working. I just get an error. See attached file for the actual .bat file I am running. What's wrong with it?
     

    Attached Files:

  2. jinvidia

    jinvidia MDL Member

    Aug 7, 2016
    238
    35
    10
    Did you change the execution policy ? Run ps as administrator. Then input
    set-executionpolicy remotesigned.
    Now run the script.
     
  3. R29k

    R29k MDL GLaDOS

    Feb 13, 2011
    5,171
    4,811
    180
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. redxii

    redxii MDL Junior Member

    Aug 7, 2016
    56
    27
    0
    More quotes around the package name will also work. The command I use:

    powershell "Get-appxprovisionedpackage -online | where-object {$_.packagename -like """*windowsalarms*"""} | remove-appxprovisionedpackage -online"
     
  5. Grywald

    Grywald MDL Novice

    Jun 25, 2014
    17
    3
    0
    #5 Grywald, Nov 4, 2017
    Last edited: Nov 8, 2017
    Code:
    This app is part of Windows and cannot be uninstalled [...]
    To resume and from my point of view, it's might be better (and easier to learn) to replace powershell by dism. Because in the past I had try several times and it has never work fine.
    That's just one advice because it will avoid this kind of errors.
     
  6. flipit

    flipit MDL Novice

    Oct 17, 2010
    13
    1
    0

    I tried to execute these command running admin powershell it did not work.
     
  7. pisthai

    pisthai Imperfect Human

    Jul 29, 2009
    7,222
    2,272
    240
    What Error PowerShell show? Please post Screenshot!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. flipit

    flipit MDL Novice

    Oct 17, 2010
    13
    1
    0

    Hey thanks for the quick response, here is the error which shows for all commands.

    packagename : The term '.packagename' is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:52
    + ... t-appxprovisionedpackage –online | where-object {.packagename –like ...
    + ~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (.packagename:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
     
  9. pisthai

    pisthai Imperfect Human

    Jul 29, 2009
    7,222
    2,272
    240
    Why didn't you post a screenshot? It gives more info than a written statement! Thanks.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. TobeBest

    TobeBest MDL Novice

    Sep 9, 2012
    2
    0
    0
    Easy way to remove the windows apps is using Ccleaner.
    anyone know how to remove or block ads from windows apps?
     
  11. °ツ

    °ツ MDL Addicted

    Jun 8, 2014
    812
    1,120
    30
    #11 °ツ, Nov 10, 2017
    Last edited: Nov 11, 2017
    You should run that as a batch script (.bat file).
    You don't even need to run it as admin, just double click the bat file.
    I used similar code to install some app without using the store.


    Forget what I wrote, it does not work now when I tested in a VM.
    It works for installing appx by using "Add-AppxPackage -Path" but it does not work for removing.
    Sorry, should have tested before posting.
     
  12. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,897
    10,733
    240
    Hi good job dude :good3: @ your post #003:)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. Nucleus

    Nucleus MDL Guru

    Aug 4, 2009
    2,868
    2,950
    90
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,897
    10,733
    240
    @ Nucleus :eek::rolleyes:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...