Announcement

Collapse
No announcement yet.

Powershell script to remove Windows 10 apppackeges

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Powershell script to remove Windows 10 apppackeges

    I would like to remove several Microsoft / Windows 10 bloatware using a script. Could you help write a sample using these power-shell commands below?

    Get-appxpackage -allusers *SpotifyAB.SpotifyMusic* | Remove-AppxPackage
    Get-appxpackage -allusers *king.com.CandyCrushFriends* | Remove-AppxPackage
    Get-appxpackage -allusers *king.com.CandyCrushSaga* | Remove-AppxPackage
    Get-appxpackage -allusers *Microsoft.Wallet* | Remove-AppxPackage

    And ideally finish this by adding a final line checking what else is installed on the computer by running

    "Get-AppxPackage -AllUsers | Select Name" and printing result to logs.

    Thank you!

  • #2
    Hi GISTeam,

    Thanks for your request. We have asked our script developers to analyse and provide feedback.

    Kind Regards,
    PremJK

    Comment


    • #3
      Hi GISTeam,

      Please try this script provided by our script developers to suffice your needs, please reach us if you face any issue
      https://scripts.itarian.com/frontend...shell-commands

      Kind Regards,
      PremJK

      Comment


      • #4
        Hey PremJK,

        Wow this was quick! that you guys!

        However, I tried the script but ended up getting this error in the logs. I've checked the computer manually and confirmed that commands didn't execute properly. I tried running the code as LocalSystem User as well as logged in user. See below, thanks again!
        2020/11/05 02:05:28 PM Finished success Access is denied. Access is denied. Access is denied. Access is denied.

        Comment


        • #5
          Hi GISTeam,

          Thanks for trying the script. We have asked our script developers to investigate the issue and provide update.

          Kind Regards,
          PremJK

          Comment


          • #6
            Hi GISTeam,

            Our script developers fixed the script link, please try now and update us your feedback
            https://scripts.itarian.com/frontend...shell-commands

            Kind Regards,
            PremJK

            Comment


            • #7
              Hello PremJK,

              Unfortunately it didn't work again. Below is the error message.
              2020/11/06 07:47:23 AM Finished success Access is denied.
              Log file are saved in C:\Temp\log.txt
              2020/11/06 07:47:20 AM Started
              I'm running the procedure on Windows 10 Pro, 2004 endpoint from Comodo Dragon Platform.

              In order to run this in person on PowerShell, we need start powershell as administrator. Would that be the reason for this issue?

              Thanks again for your help!
              GISTeam

              Comment


              • #8
                Hi GISTeam,

                Our script developers requesting a remote session to investigate the issue. Can you please help us in providing remote.

                If yes, please let us know the best date and time to schedule.

                Kind Regards,
                PremJK

                Comment


                • #9
                  Hey PremJK, I was out of the office for a few days. But I'm back now. Yes I would like to help you help me I'm in California time zone, we can meet at anytime on November 13 or 14 from 8 AM to 6 PM California time. I'm also willing to meet with you guys after 6 PM, however my time might be limited. Please let me know your availability for a live session. Thanks again for your help again!

                  Comment


                  • #10
                    Hi GISTeam,

                    Thanks for your response. Our support team will reach you for arrange remote session.

                    Kind Regards,
                    PremJK

                    Comment


                    • #11
                      Hello GISTeam and @PremJkumar,

                      I have previously created a powershell script converted into a procedure for this very task that has so far worked well for me. Perhaps you may find it useful. I added a quick function to list all remaining install apps as was desired.

                      This script will auto-elevate for UAC permission purposes (which is required when dealing with appxpackages), and will output a log file to a specified location. It also uses the parameter feature of ITSM procedures so you can specify the app names and log location path at runtime (or save to the procedure as default) without needing to edit the code which is useful in reusing the script.

                      Here is an exported copy. Feel free to edit to fit your needs.
                      20201114-Remove-AppxPackages-Win10-EZT-DM-V1.json

                      Rundown of Parameters
                      • Output Log Folder - Enter the path where you wish for the log files to be stored
                        • Example: C:\Temp\DebloatLogs
                      • Remove Apps ("*Zune*","*Music*") comma separated - List the appx names you wish to remove. Each one must be surrounded by quotes "" and a comma must seperate each entry.
                        • Example: "*Spotify*","*CandyCrush*","*Wallet*"
                        • Note: You can specified wildcards by surrounding the name with *. So instead of putting "*king.com.CandyCrushFriends*", you can just use "*CandyCrush*". Any app with that name will be included and removed.
                      I have been able to use this successfully on many Win 10 workstations. Just run as system. I should add a disclaimer that even still my overall testing is limited, as I've only used it on one network with all similar images. Also the code formatting is a bit messy, as its something I put together quickly and haven't returned to recently, if that matters.

                      Perhaps you already have this resolved but I figured I'd share just in case it is helpful in any way.

                      Thanks!
                      Mike
                      Last edited by eztech; 11-14-2020, 01:30 PM.

                      Comment


                      • GISTeam
                        GISTeam commented
                        Editing a comment
                        Hey Mike,

                        I appreciate the help! This looks great, however I'm not sure where to put the name of apps. is it here, like shown below.
                        import ctypes
                        file='C:\\Windows\Temp\debloatwin10.ps1';
                        input="*Zune*","*Music*"
                        #This script finds any AppX/AppXProvisioned package specified and uninstalls it....

                        Thanks a lot!

                    • #12
                      Hi eztech,

                      Thank you so much for your valuable input. Will share this information with our script developers.

                      Kind Regards,
                      PremJK

                      Comment


                      • #13
                        GISTeam
                        The name of the apps are entered under the parameters. You should not need to edit any of the code directly. Once you import the procedure, go the parameters tab as seen here:
                        Click image for larger version  Name:	Capture.PNG Views:	0 Size:	50.4 KB ID:	50511

                        Under RemoveWindows10Appx, enter the name(s) in the Default Value field. The values there currently are for example to show you how the format should be.

                        Once done save the procedure then run it on your system(s) of choice, choosing to run as system.

                        Just in case your still having difficulty, here is a copy of the procedure with the default parameters per-configured for app names you specified in your first post. Just import, then run against your target machines. Logs output to a text file in C:\Temp\DebloatLogs on the machine the procedure is run against, as well as under the Execution Logs tab of the procedure in the ITSM portal.
                        20201117-Remove-AppxPackages-Win10-GISTeam.json

                        I hope that helps.
                        Last edited by eztech; 11-17-2020, 04:38 AM.

                        Comment

                        Working...
                        X