Sign in to follow this  
Followers 0

Remove Windows Apps for All Users

4 posts in this topic

I have messed with this time to time, but recently decided to go ahead and push it out because I have so many people having the default reader app take over adobe and since they are not admins they cant easily change the default program to adobe for their profile.

To remove the app for the current user I use.

get-appxpackage | where name -like '*reader*' | remove-appxpackage

If it is a new computer build I can remove the app from the system so it does not install for any new users with this.

get-provisionedappxpackage -online | where displayname -like '*reader*' | remove-appxprovisionedpackage -online

So where I am stuck is getting it off existing accounts on computers in the field.  Every article, document, etc I can find says all you need to do is add the -allusers flag.

If I add the flag to the get package part it does show the package for each user, but when I pipe it into the remove-package cmdlet I get an error that the package is not installed for the current user and it does not uninstall it for any other account.

This is what I have tried:

get-appxpackage -allusers | where name -like '*reader*' | remove-appxpackage

Also a revision of it

get-appxpackage -allusers *reader* | remove-appxpackage

As far as I can tell, this is correct but simply is not working. 

Any ideas or anybody know what the key issue that I am overlooking is?

Share this post

Link to post
Share on other sites

Have you tried something like this?

Get-AppxPackage -allusers -Name *reader* | Remove-AppxPackage


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post

Link to post
Share on other sites
14 hours ago, JLogan3o13 said:

Have you tried something like this?

Get-AppxPackage -allusers -Name *reader* | Remove-AppxPackage


Yes, that was an alteration I tried.

Share this post

Link to post
Share on other sites

#4 ·  Posted (edited)

You know, there are scripts available on Microsoft's script repository that might be of help.  I would try these:

These might get you to where you need to be.

Edited by MattHiggs

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • bstjohn
      Silent uninstall broken in Win10 -- need suggestions for workaround
      By bstjohn
      I'm running AutoIT v3.3.14.2 on Windows 10 ver 1511.  The September Cumulative Update from Microsoft has broken the way some third party credential providers work.  You can see more detail here:
      So I want to automatically and silently remove this update from all our machines.  In Windows 7 I could easily do it with this:
      wusa.exe /uninstall /kb:3185614 /quiet
      But apparently Microsoft has taken away the /quiet switch functionality in Windows 10.   wusa /? will show that the switch is there, but when trying to use it error 87 (invalid parameter) is returned.
      So I relented on that point and decided to run wusa without the quiet switch.  It pops up a child window that prompts for confirmation before uninstalling the update.  Sounds like a perfect job for AutoIT, right?  Except I can't get the button to click, either using ControlClick or ControlSend or Send.  I can select it by sending the {Alt} key to it and it highlights.  But I just can't get it to accept the click or {Enter}.
      I then tried using Powershell and DISM to remove the package, but this is a hotfix and doesn't have a package name, so I can't use dism /remove-package, either.
      Does anybody have any other ideas how this can be done silently?
    • TechScott
      Can I user AutoIT as a front-end to Powershell?
      By TechScott
      I have a rather heady PowerShell script that requires a few inputs that I would like to present as pick lists/pull down lists.  I've fiddled with doing this using Windows API calls and frankly it's pretty ugly and non-productive.  What I'd like to accomplish is to present the user with a refined UI that will force them to color between the lines and catch any error putput and display it to them in an organized fashion.
      Has anyone done this?  I'd like to have an AutoIT based solution as my current client didn't plan on any extra time or budget to accomplish this task.
    • iamtheky
      certificate search by thumbprint
      By iamtheky
      #include<array.au3> _ArrayDisplay(_GetCertByThumb("")) ;~ "A1B9894B9BB100F43A229D65CC3C306FBF0BB9F8" Func _GetCertByThumb($sThumbprint = "") $sCommands = 'Powershell get-childitem -Path Cert:\CurrentUser -Recurse -Name | FindStr /L "\\"' & $sThumbprint $iPID = Run(@ComSpec & " /c " & $sCommands, "", @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aRtn = stringsplit($sOutput , @LF , 2) _ArrayDelete($aRtn , ubound($aRtn) - 1) If ubound($aRtn) < 1 then _ArrayAdd($aRtn , "No Match Found") Return $aRtn EndFunc  
    • water
      Analyzing COM objects
      By water
      Just for the records:
      MS provides an easy method to retrieve the methods, properties, events of COM objects by using PowerShell.
      Open powershell. Create the object. The syntax is:
      $variable = New-object -ComObject "ProgID" Type the variable name to retrieve the properties of the object Use "Get-Member" to retrieve all properties, methods, collections and events of the object Example: 
      $IE = New-object -ComObject "InternetExplorer.Application" $IE $IE|Get-Member PS> $object = New-Object -COMObject "InternetExplorer.Application" PS> $object Application          : System.__ComObject Parent               : System.__ComObject Container            : Document             : TopLevelContainer    : True Type                 : Left                 : 309 Top                  : 92 Width                : 1383 Height               : 870 LocationName         : LocationURL          : Busy                 : False Name                 : Windows Internet Explorer HWND                 : 2361028 FullName             : C:\Program Files\Internet Explorer\iexplore.exe Path                 : C:\Program Files\Internet Explorer\ Visible              : False StatusBar            : True StatusText           : ToolBar              : 1 MenuBar              : True FullScreen           : False ReadyState           : 0 Offline              : False Silent               : False RegisterAsBrowser    : False RegisterAsDropTarget : True TheaterMode          : False AddressBar           : True Resizable            : True PS> $object|Get-Member    TypeName: System.__ComObject#{d30c1661-cdaf-11d0-8a3e-00c04fc9e26e} Name                 MemberType Definition ----                 ---------- ---------- ClientToWindow       Method     void ClientToWindow (int, int) ExecWB               Method     void ExecWB (OLECMDID, OLECMDEXECOPT, Variant, Variant) GetProperty          Method     Variant GetProperty (string) GoBack               Method     void GoBack () GoForward            Method     void GoForward () GoHome               Method     void GoHome () GoSearch             Method     void GoSearch () Navigate             Method     void Navigate (string, Variant, Variant, Variant, Variant Navigate2            Method     void Navigate2 (Variant, Variant, Variant, Variant, Varia PutProperty          Method     void PutProperty (string, Variant) QueryStatusWB        Method     OLECMDF QueryStatusWB (OLECMDID) Quit                 Method     void Quit () Refresh              Method     void Refresh () Refresh2             Method     void Refresh2 (Variant) ShowBrowserBar       Method     void ShowBrowserBar (Variant, Variant, Variant) Stop                 Method     void Stop () AddressBar           Property   bool AddressBar () {get} {set} Application          Property   IDispatch Application () {get} Busy                 Property   bool Busy () {get} Container            Property   IDispatch Container () {get} Document             Property   IDispatch Document () {get} FullName             Property   string FullName () {get} FullScreen           Property   bool FullScreen () {get} {set} Height               Property   int Height () {get} {set} HWND                 Property   int64 HWND () {get} Left                 Property   int Left () {get} {set} LocationName         Property   string LocationName () {get} LocationURL          Property   string LocationURL () {get} MenuBar              Property   bool MenuBar () {get} {set} Name                 Property   string Name () {get} Offline              Property   bool Offline () {get} {set} Parent               Property   IDispatch Parent () {get} Path                 Property   string Path () {get} ReadyState           Property   tagREADYSTATE ReadyState () {get} RegisterAsBrowser    Property   bool RegisterAsBrowser () {get} {set} RegisterAsDropTarget Property   bool RegisterAsDropTarget () {get} {set} Resizable            Property   bool Resizable () {get} {set} Silent               Property   bool Silent () {get} {set} StatusBar            Property   bool StatusBar () {get} {set} StatusText           Property   string StatusText () {get} {set} TheaterMode          Property   bool TheaterMode () {get} {set} ToolBar              Property   int ToolBar () {get} {set} Top                  Property   int Top () {get} {set} TopLevelContainer    Property   bool TopLevelContainer () {get} Type                 Property   string Type () {get} Visible              Property   bool Visible () {get} {set} Width                Property   int Width () {get} {set}
    • JBeardNC
      How to call WMI Method
      By JBeardNC
      I'm having a heck of a time trying to figure out how to call/invoke a WMI method through Autoit. I have a Powershell script that checks if a reboot is required using multiple checks including a WMI method related to ConfigMgr/SCCM but I want to do this in Autoit because I have a script that does other things and prompts the user to reboot if needed. I've given up on trying to make Autoit run the Powershell script and capture the true/false return value so since I know how to do everything the Powershell script does in Autoit, minus this WMI method call, I figured I'd take a stab at doing all of it in Autoit.
      The WMI method involved is called DetermineIfRebootPending in the root\ccm\ClientSDK namespace in the CCM_ClientUtilities class. I've done some searching on the forums here and saw many references to the Scriptomatic so I downloaded that and when I run it, since (I'm guessing) there are no properties in the CCM_ClientUtilities class, it doesn't show up as an available option in the class dropdown (see attached image), so it doesn't seem like Scriptomatic is going to help me here unless I'm missing something. Here is the Powershell part that I'd like to convert to Autoit.
      $CCMClientSDK = $null $CCMSplat = @{      NameSpace='ROOT\ccm\ClientSDK'      Class='CCM_ClientUtilities'      Name='DetermineIfRebootPending'      ComputerName=$ComputerName      ErrorAction='SilentlyContinue' } $CCMClientSDK = Invoke-WmiMethod @CCMSplat If ($CCMClientSDK.IsHardRebootPending -or $CCMClientSDK.RebootPending) {      $SCCMReboot = $true } So as you can see, its invoking the DetermineIfRebootPending method and then checking the IsHardRebootPending and RebootPending properties to see if they are True or False. If either are true, it sets the $SCCMReboot to true and later on down the script, it returns that value to the pipeline after checking some other registry locations to determine if reboot is required. 
      If anyone could help me either 1) convert the above code to Autoit or 2) figure out how to run the powershell script from within Autoit and capture the return value, I'd be forever grateful. Thanks!