ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved Uninstalling Programs (Windows 10) Using Powershell

    Water Closet
    powershell windows10 virtualbox
    5
    27
    2.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • WrCombsW
      WrCombs
      last edited by

      Ive seen multiple people using

      $app= Get-WmiObject =class win32 product | where-object {
      $._Name- Match "*Program Name*" 
      }
      $app Unistall()
      
      
      

      But when ever I do it i get this error :

      $app uninstall() is not an expression
      

      Does anyone know anything about this?
      any help appreciated

      This is for personal computer uninstalling to reinstall a program thats causing me problems before the upgrade and now trying to get it to work again.

      1 Reply Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller
        last edited by

        Try this instead:

        (Get-WmiObject -Class Win32_Product -Filter "Name='Oracle VM VirtualBox'" -ComputerName . ).Uninstall()
        
        1 Reply Last reply Reply Quote 0
        • WrCombsW
          WrCombs
          last edited by

          I could go the GUI way but I want to try uninstalling through Powershell to get more of the CLI feel (thinking about making my way to linux completely eventually)

          Everything ive seen says that this should working in Powershell ISE. Screen shots to come.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by

            @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

            $app uninstall() is not an expression

            You are missing the period.

            $app.Uninstall()
            

            It's a method.

            WrCombsW 1 Reply Last reply Reply Quote 0
            • WrCombsW
              WrCombs @scottalanmiller
              last edited by

              @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

              @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

              $app uninstall() is not an expression

              You are missing the period.

              $app.Uninstall()
              

              It's a method.

              https://i.imgur.com/0o8165E.png

              scottalanmillerS 1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller
                last edited by

                $app is a variable, in PowerShell that makes it an object so it can have methods. On its own, you can't just call a variable and expect some action. Look at the first like, you have $app = some stuff. That's like in math, x = the square root of 9. X doesn't "do" anything, it just represents a number.

                Same here. $app is a variable like x, it just represents the identity of the application that you want to remove.

                But since it is an object, that inherits from some class that has methods for handling application removal, you can use its "uninstall()" method to uninstall it. A method is called via the dot notation.

                So $app.methodName() allows the methodName() to take some action on the object $app

                1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller @WrCombs
                  last edited by

                  @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                  @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                  @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                  $app uninstall() is not an expression

                  You are missing the period.

                  $app.Uninstall()
                  

                  It's a method.

                  https://i.imgur.com/0o8165E.png

                  That's a totally different error. This is that your Get-WmiObject call is incorrect.

                  WrCombsW 1 Reply Last reply Reply Quote 0
                  • WrCombsW
                    WrCombs @scottalanmiller
                    last edited by

                    @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                    @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                    @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                    @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                    $app uninstall() is not an expression

                    You are missing the period.

                    $app.Uninstall()
                    

                    It's a method.

                    https://i.imgur.com/0o8165E.png

                    That's a totally different error. This is that your Get-WmiObject call is incorrect.

                    I noticed that as well

                    1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller
                      last edited by

                      Try this instead:

                      (Get-WmiObject -Class Win32_Product -Filter "Name='Oracle VM VirtualBox'" -ComputerName . ).Uninstall()
                      
                      1 Reply Last reply Reply Quote 0
                      • scottalanmillerS
                        scottalanmiller
                        last edited by

                        Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                        WrCombsW 1 Reply Last reply Reply Quote 0
                        • WrCombsW
                          WrCombs @scottalanmiller
                          last edited by

                          @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                          Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                          I did install via Chocolatey does that have something to do with it?

                          scottalanmillerS 1 Reply Last reply Reply Quote 0
                          • scottalanmillerS
                            scottalanmiller @WrCombs
                            last edited by

                            @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                            @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                            Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                            I did install via Chocolatey does that have something to do with it?

                            Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                            To uninstall something managed with Chocolatey you just do...

                            choco uninstall packagename
                            
                            WrCombsW JaredBuschJ 2 Replies Last reply Reply Quote 0
                            • scottalanmillerS
                              scottalanmiller
                              last edited by

                              Remember, Chocolatey brings simple package management to Windows via repos the way that all of the non-Windows world has worked for decades. None of that bizarre, complicated need to script basic tasks, it's just a trivial command away to install, update, uninstall, etc.

                              WrCombsW 1 Reply Last reply Reply Quote 0
                              • WrCombsW
                                WrCombs @scottalanmiller
                                last edited by

                                @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                                @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                                I did install via Chocolatey does that have something to do with it?

                                Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                                To uninstall something managed with Chocolatey you just do...

                                choco uninstall packagename
                                

                                That would make a whole lot of sense.

                                1 Reply Last reply Reply Quote 0
                                • WrCombsW
                                  WrCombs @scottalanmiller
                                  last edited by

                                  @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                  Remember, Chocolatey brings simple package management to Windows via repos the way that all of the non-Windows world has worked for decades. None of that bizarre, complicated need to script basic tasks, it's just a trivial command away to install, update, uninstall, etc.

                                  And now that you say something I remember there being a time I had to unistall... I over complicated that.

                                  1 Reply Last reply Reply Quote 0
                                  • JaredBuschJ
                                    JaredBusch @scottalanmiller
                                    last edited by

                                    @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                    @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                                    @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                    Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                                    I did install via Chocolatey does that have something to do with it?

                                    Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                                    Actually, no. It is almost always there for windows to see. Because most chocolatey installs actually use the default windows installer. Just with a /silent switch (or whatever is appropriate).

                                    scottalanmillerS WrCombsW 2 Replies Last reply Reply Quote 0
                                    • scottalanmillerS
                                      scottalanmiller @JaredBusch
                                      last edited by

                                      @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                      @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                      @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                                      @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                      Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                                      I did install via Chocolatey does that have something to do with it?

                                      Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                                      Actually, no. It is almost always there for windows to see. Because most chocolatey installs actually use the default windows installer. Just with a /silent switch (or whatever is appropriate).

                                      Oh, I thought it never did that. I must have just worked with a few that didn't.

                                      JaredBuschJ 1 Reply Last reply Reply Quote 0
                                      • JaredBuschJ
                                        JaredBusch @scottalanmiller
                                        last edited by

                                        @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                        @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                        @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                        @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                                        @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                        Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                                        I did install via Chocolatey does that have something to do with it?

                                        Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                                        Actually, no. It is almost always there for windows to see. Because most chocolatey installs actually use the default windows installer. Just with a /silent switch (or whatever is appropriate).

                                        Oh, I thought it never did that. I must have just worked with a few that didn't.

                                        Chocolatey does not put anything in there. But since most packages are just using the normal installer in silent mode, it is generally there.

                                        scottalanmillerS 1 Reply Last reply Reply Quote 1
                                        • scottalanmillerS
                                          scottalanmiller @JaredBusch
                                          last edited by

                                          @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                          @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                          @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                          @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                          @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                                          @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                          Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                                          I did install via Chocolatey does that have something to do with it?

                                          Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                                          Actually, no. It is almost always there for windows to see. Because most chocolatey installs actually use the default windows installer. Just with a /silent switch (or whatever is appropriate).

                                          Oh, I thought it never did that. I must have just worked with a few that didn't.

                                          Chocolatey does not put anything in there. But since most packages are just using the normal installer in silent mode, it is generally there.

                                          Makes sense.

                                          ObsolesceO 1 Reply Last reply Reply Quote 0
                                          • ObsolesceO
                                            Obsolesce @scottalanmiller
                                            last edited by

                                            @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                            @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                            @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                            @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                            @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                            @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                                            @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                            Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                                            I did install via Chocolatey does that have something to do with it?

                                            Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                                            Actually, no. It is almost always there for windows to see. Because most chocolatey installs actually use the default windows installer. Just with a /silent switch (or whatever is appropriate).

                                            Oh, I thought it never did that. I must have just worked with a few that didn't.

                                            Chocolatey does not put anything in there. But since most packages are just using the normal installer in silent mode, it is generally there.

                                            Makes sense.

                                            It's like that with every package I've installed. One example is salt minion. If you install that with chocolatey, then uninstall it via Windows control panel, then try installing it again with Chocolatey, Chocolatey thinks it's still installed because doing it through Windows never tells Chocolatey it was installed. You have to use the force switch to install it again with Chocolatey.

                                            The same goes for all Chocolatey packages I've used... 7zip, Firefox, Chrome, etc.

                                            scottalanmillerS black3dynamiteB 2 Replies Last reply Reply Quote 0
                                            • scottalanmillerS
                                              scottalanmiller @Obsolesce
                                              last edited by

                                              @obsolesce said in Uninstalling Programs (Windows 10) Using Powershell:

                                              @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                              @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                              @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                              @jaredbusch said in Uninstalling Programs (Windows 10) Using Powershell:

                                              @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                              @wrcombs said in Uninstalling Programs (Windows 10) Using Powershell:

                                              @scottalanmiller said in Uninstalling Programs (Windows 10) Using Powershell:

                                              Now, I thought that you had installed this via Chocolatey, not the Windows installer, though. Based on other threads.

                                              I did install via Chocolatey does that have something to do with it?

                                              Yes, a lot. Chocolatey is its own package management system. So Get-WmiObject knows nothing about it and can't interact with it. It's not "installed" in Windows terms, it's just "sitting there."

                                              Actually, no. It is almost always there for windows to see. Because most chocolatey installs actually use the default windows installer. Just with a /silent switch (or whatever is appropriate).

                                              Oh, I thought it never did that. I must have just worked with a few that didn't.

                                              Chocolatey does not put anything in there. But since most packages are just using the normal installer in silent mode, it is generally there.

                                              Makes sense.

                                              It's like that with every package I've installed. One example is salt minion. If you install that with chocolatey, then uninstall it via Windows control panel, then try installing it again with Chocolatey, Chocolatey thinks it's still installed because doing it through Windows never tells Chocolatey it was installed. You have to use the force switch to install it again with Chocolatey.

                                              The same goes for all Chocolatey packages I've used... 7zip, Firefox, Chrome, etc.

                                              A bit like deleting files and then the RPM database has no idea what has happened.

                                              1 Reply Last reply Reply Quote 0
                                              • 1
                                              • 2
                                              • 1 / 2
                                              • First post
                                                Last post