Script for uninstalling multiple programs?

Kai123Kai123 Member Posts: 364 ■■■□□□□□□□
Hello forum.

Second week into my internship, and I was tasked with removing pre-installed software from the OEM PC's that we get in.

I am sat here, uninstalling one by one about 15 programs. I'm assuming its possible to write a INI script to uninstall them with just one click? (bar the odd message).

Kai.

Comments

  • cyberguyprcyberguypr Senior Member Mod Posts: 6,882 Mod
    Format C: /u icon_smile.gif

    What kind of environment is this? I'm sure it's not possible now since the machines have been in use, but I've always been a fan of wiping machines when brand new and loading a fresh image. Of course if there's no volume license or equivalent, this may be a problem.
  • QordQord Senior Member Member Posts: 631 ■■■■□□□□□□
    PC Decrapifyer (sp?) can do this, but you might need the commercial license. It's cheap though.

    You could script it I'm sure. You'd just need to find the installer files and execute them CMD-style with the uninstall flags. This could take a while to get right and might not be worth the time unless you're interested in the journey just as much as the destination.
  • Kai123Kai123 Member Posts: 364 ■■■□□□□□□□
    Its PC's we get for labs in a dental hospital.

    They come with lenovo stuff pre-installed but it messes with the domain configuration when they are set up. I sit down for 30 minutes and go through it via uninstall programs. Found out that there will be around 35+ of these, hence the desperation for a solution :D

    It is about the journey though. Its not expected of me, but it seems simple enough once I know their "default" location.
  • BerkshireHerdBerkshireHerd Member Posts: 185
    Do they use KACE?
    Identity & Access Manager // B.A - Marshall University 2005
  • ccnxjrccnxjr Member Posts: 304
    K, I don't have any custom scripts myself, but I'm guessing you'll be powershelling this a bit.
    It's been a while since I dug into it, but I think your journey will start here :
    Use PowerShell to Find Installed Software - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs

    Just to first check to see if the software you want to un-install is listed in the Add/Remove programs list.
    Ultimately, I think you're looking for something like this :
    Use PowerShell to Find and Uninstall Software - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs

    However the actual commands might be slightly different on your version of Windows.



  • Kai123Kai123 Member Posts: 364 ■■■□□□□□□□
    They don't use KACE.

    The guy I replaced spent two weeks trying to get something like this to work. I have literally no scripting skills, but as a pet project this would be a good place to start, and would be insanely useful and maybe give me some credibility.

    I have literally on average 4 hours a day downtime when the technicians are out, manager out and my sole responsibility for that moment is manning the phone (maybe 1 in every 2 hours?). I've been studying away for the ITILv3 but it puts me in a coma after an hour. If I make any progress I'll let you know ;) Thanks guys!
  • alokin123alokin123 Member Posts: 268
    i recently had to look at uninstalling a certain product and was going to use the uninstall command from the registry (which doesnt always work) and in my googling i came across wmic as a means of uninstalling programs. A lot people dont seem to recommend using wmic but i thought it was a pretty cool way of uninstall programs.

    IT Pro Tips for Oracle Java 7 Update 15 7 | ITNinja
  • W StewartW Stewart Member Posts: 794 ■■■■□□□□□□
    Setup a windows imaging server and have those PCs running an unattended install when they come in.
    Being a sys admin sucks but I love it
  • JeanMJeanM Member Posts: 1,117
    If you are uninstalling the same programs over and over again, then find their msiexec uninstall command and test it one one box, then script it with some pause logic or even clean up folder / reg keys if stuff is left behind.

    First thing would be to understand what it is you need to uninstall, what to remove and from where.. Then you can script it.
    2015 goals - ccna voice / vmware vcp.
  • QordQord Senior Member Member Posts: 631 ■■■■□□□□□□
    WMIC is an OK option I think, I've used it a few times to do remote uninstalls, but I wouldn't use it for this.
    Kai123 wrote: »
    ...I have literally on average 4 hours a day downtime...
    Oh man, that's plenty of time to figure this out!! :D How do you feel about using the command line? Here's how I would start:

    I’d pick one of the programs that needs uninstalling and find its pieces. Specifically, the installer. For example, let’s use the CrapTastic5000 application by Dellenovo. (If you can name one of the bloatware apps already installed I can be a little more realistic) Looking at the program, I can see that it lives in c:\program files (x86)\Dellenovo\CrapTastic\Craptastic5000.exe. Knowing where the program itself lives, there’s a good chance that the installer lives there (or close to there) too. So I’d look for something like “install.msi” or something similar to that. Since it’s an msi file, I know there are certain command-line flags (Msiexec - Windows installer | Windows CMD | SS64.com, Msiexec (command-line options)) I can use to run the installer in a manner that un-installs it, and does so silently. From here, I’d open a command prompt and play with the msiexec command line tool to figure out how to make this happen. In a cmd window, I’d enter:

    Msiexec /x “c:\program files (x86)\Dellenovo\CrapTastic\install.msi”

    And see what happens. Best case, it uninstalls without any other input. Worst case, it runs and asks you a bunch of questions. When you’ve got the syntax down for all the programs, then you can think about automating it. Powershell is perfect for this because it accepts regular CMD commands, so if it works in CMD it will work in Powershell.

    If you have any doubts or troubles with uninstalling these programs, google it. Google for phrases like “app-name command line uninstall”, “app-name unattended uninstall”, even “app-name silent install” can be helpful.
  • DeathmageDeathmage Banned Posts: 2,496
    Qord wrote: »
    WMIC is an OK option I think, I've used it a few times to do remote uninstalls, but I wouldn't use it for this.


    Oh man, that's plenty of time to figure this out!! :D How do you feel about using the command line? Here's how I would start:

    I’d pick one of the programs that needs uninstalling and find its pieces. Specifically, the installer. For example, let’s use the CrapTastic5000 application by Dellenovo. (If you can name one of the bloatware apps already installed I can be a little more realistic) Looking at the program, I can see that it lives in c:\program files (x86)\Dellenovo\CrapTastic\Craptastic5000.exe. Knowing where the program itself lives, there’s a good chance that the installer lives there (or close to there) too. So I’d look for something like “install.msi” or something similar to that. Since it’s an msi file, I know there are certain command-line flags (Msiexec - Windows installer | Windows CMD | SS64.com, Msiexec (command-line options)) I can use to run the installer in a manner that un-installs it, and does so silently. From here, I’d open a command prompt and play with the msiexec command line tool to figure out how to make this happen. In a cmd window, I’d enter:

    Msiexec /x “c:\program files (x86)\Dellenovo\CrapTastic\install.msi”

    And see what happens. Best case, it uninstalls without any other input. Worst case, it runs and asks you a bunch of questions. When you’ve got the syntax down for all the programs, then you can think about automating it. Powershell is perfect for this because it accepts regular CMD commands, so if it works in CMD it will work in Powershell.

    If you have any doubts or troubles with uninstalling these programs, google it. Google for phrases like “app-name command line uninstall”, “app-name unattended uninstall”, even “app-name silent install” can be helpful.

    I concur. Msiexec switches are quickest way to uninstall. Plus you can do it silent so you don't see a interactive pane. :) you can easily right a batch file like this off the top of my head:

    Echo color A0
    Msiexec icon_sad.gifc:install path hereyardage Yarra) - lol dam smiley face took my ( ;)
    Pause - so you can see if it fails kind of helpful sometimes
    Exit

    Then save it as a filename.bat and then execute it. Do a Msiexec /? to find the command that is right for you.

    I can drop in a batch file in the morning. I've written a number of batch programs for automation in the past year for task scheduler in 2008 R2.
  • Kai123Kai123 Member Posts: 364 ■■■□□□□□□□
    Well, that ended quick! Turns out we wont be getting these PC's in for a good while, maybe 6 months time since they already have a stock of unused PC's that can be used instead.

    IT manager was impressed that I was going to give it a go. Might of gave the wrong impression that I'm capable of scripting anything ;)
Sign In or Register to comment.