+ Post New Thread
Results 1 to 13 of 13
How do you do....it? Thread, Network wide uninstall in Technical; I need to uninstall an application from all of the machines on the network, before installing a new app. I ...
  1. #1
    leco's Avatar
    Join Date
    Nov 2006
    Location
    West Yorkshire
    Posts
    2,026
    Thank Post
    595
    Thanked 125 Times in 119 Posts
    Rep Power
    41

    Network wide uninstall

    I need to uninstall an application from all of the machines on the network, before installing a new app. I have a command line instruction to do this ... but I have no idea how to send that instruction across the network short of physically/virtually visiting each machine

    Code:
    msiexec.exe /x {an-extremely-long-product-code} /q
    I'm guessing that it could be at the start of the .mst for the new app. Could someone please advise?

  2. #2


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,688
    Thank Post
    352
    Thanked 794 Times in 714 Posts
    Rep Power
    346
    How was said application allocated? Can you not 'de-allocate' it per say?

    You can use psexec to connect to a machine and run that command you have there.

    You'll need a list of applicable workstation names and a spreadsheet to create your lines to do it.

    Or, you could depending upon what the application is and the environment your machines are in run that command in a start up script.

  3. #3
    leco's Avatar
    Join Date
    Nov 2006
    Location
    West Yorkshire
    Posts
    2,026
    Thank Post
    595
    Thanked 125 Times in 119 Posts
    Rep Power
    41
    Quote Originally Posted by kmount View Post
    How was said application allocated?
    Physically installed at differing times.

    You can use psexec to connect to a machine and run that command you have there.

    You'll need a list of applicable workstation names and a spreadsheet to create your lines to do it.
    It might take me as long to type the list as visit each comp.

    Or, you could depending upon what the application is and the environment your machines are in run that command in a start up script.
    OK don't know much about running start up scripts, give me clue?

  4. #4

    Join Date
    Mar 2008
    Location
    Surrey
    Posts
    2,168
    Thank Post
    98
    Thanked 319 Times in 261 Posts
    Blog Entries
    4
    Rep Power
    112
    Start-up script's one option.

    Or there's the psexec option, but using VBscript or Powershell to grab a list of all computers in the domain and dump their names into the psexec command line.

    Code:
    $strCategory = "computer"
    $objDomain = New-Object System.DirectoryServices.DirectoryEntry
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $objDomain
    $objSearcher.Filter = ("(objectCategory=$strCategory)")
    $colProplist = "name"
    foreach ($i in $colPropList)
    {
     $objSearcher.PropertiesToLoad.Add($i)
    }
    $colResults = $objSearcher.FindAll()
    foreach ($objResult in $colResults)
    {
     $objComputer = $objResult.Properties
     Write-Host("Uninstalling from $objComputer.name")
     & psexec \\$objComputer.name -u <username> -p <password> msiexec.exe /x {an-extremely-long-product-code} /q
    }
    You can take out the -u <username> and -p <password> bits if you don't need to run the uninstall under a specific account, or throw in a -s command to run it under the system account.

  5. #5
    leco's Avatar
    Join Date
    Nov 2006
    Location
    West Yorkshire
    Posts
    2,026
    Thank Post
    595
    Thanked 125 Times in 119 Posts
    Rep Power
    41
    Quote Originally Posted by kmount View Post
    How was said application allocated? Can you not 'de-allocate' it per say?

    You can use psexec to connect to a machine and run that command you have there.

    You'll need a list of applicable workstation names and a spreadsheet to create your lines to do it.

    Or, you could depending upon what the application is and the environment your machines are in run that command in a start up script.
    Thanks for this and sorry to be such a dim brain but I don't know what to do with it.

  6. #6

    Join Date
    Mar 2008
    Location
    Surrey
    Posts
    2,168
    Thank Post
    98
    Thanked 319 Times in 261 Posts
    Blog Entries
    4
    Rep Power
    112
    Quote Originally Posted by leco View Post
    Thanks for this and sorry to be such a dim brain but I don't know what to do with it.
    psexec is a command-line tool for remotely running commands. You can find all the details on it here: PsExec

    If you use the @file parameter you can specify a file with a list of computers which it'll then run the command against. If you don't have a file, you can use the PowerShell script above to pipe the output to a file instead of psexec and then use that list in the command.

  7. Thanks to jamesb from:

    leco (21st July 2009)

  8. #7
    leco's Avatar
    Join Date
    Nov 2006
    Location
    West Yorkshire
    Posts
    2,026
    Thank Post
    595
    Thanked 125 Times in 119 Posts
    Rep Power
    41
    Thanks jamesb, will have a go at that today.

  9. #8

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123
    Do you have a machine startup script configured for machines in your domain? If so then you can add this to that script. if not, then now is a good time to get one :-)

    In group policy management console, right click at the top of the domain and choose create and link a GPO here - call it something like "machine startup settings". Edit the GPO and under Computer Configuration, Windows Settings you'll find "Scripts Startup/Shutdown"

    Double click on the startup option and you'll get a screen where you can add a script. I like to keep scripts for a GPO in the GPO folder (others don't ...) so click on show files to get an explorer window for this location. Right click and choose New text file. Name it "uninstall.cmd" (make sure it isn't uninstall.cmd.txt) and then edit it.

    In the notepad window which comes up, paste in your uninstall command and save the script. Shutdown and restart a machine and at startup the batch file should run and uninstall your software.

    (Note: it's probably safest to test this by initially linking your GPO to an OU with just one test PC in it - that way you don't mess up the entire network. The other thing is that this will run at every startup; ideally you only want it to run if it's not run before but if you can be sure that all the machines will be turned on in a day you can just leave it in place for one full day then remove the GPO)

  10. Thanks to srochford from:

    leco (21st July 2009)

  11. #9
    leco's Avatar
    Join Date
    Nov 2006
    Location
    West Yorkshire
    Posts
    2,026
    Thank Post
    595
    Thanked 125 Times in 119 Posts
    Rep Power
    41
    Brilliant, thanks Steve, that looks just the ticket. You guessed right in that I do not at the moment have any such scripts. Will take your step by step and test on one OU - fingers crossed that it works.

  12. #10
    leco's Avatar
    Join Date
    Nov 2006
    Location
    West Yorkshire
    Posts
    2,026
    Thank Post
    595
    Thanked 125 Times in 119 Posts
    Rep Power
    41
    It worked Ran a test machine - software uninstalled, so far so good. Ran a GPO containing the new software - installed, even better. Logged on - software all there but ... it reminded me of the Fast Show. Interia - scortchio. Costa - scortchio. Unfortunately I'd used the wrong language.mst and I had Portugese instead of English. Still all is not lost, removed the GPO, restarted the test machine and it all uninstalled itself

    Another day tomorrow to get it right. Someone once said "If a job's worth doing it's worth doing twice." Just got to hope that twice will be enough.

    Thanks for the help.

  13. #11


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,688
    Thank Post
    352
    Thanked 794 Times in 714 Posts
    Rep Power
    346
    Sorry had been out all day, glad you got it sorted.

  14. #12

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123
    If you can guarantee that all machines will be switched on "today" to do the uninstall and then "tomorrow" you remove that GPO and do the install then you can carry on like this.

    Stage 2 is to develop the process so it copes with the situation where you're not sure when stuff will be switched on. In essence, you add a check to the process - there are loads of ways to do this but one would be to have a folder in which you put flag files.

    Your uninstall batch file then looks something like this:
    Code:
    if not exist %windir%\schoolname md %windir%\schoolname
    if exist %windir%\schoolname\packagename.1 goto end
    msiexec.exe /x {an-extremely-long-product-code} /q
    echo uninstalled > %windir%\schoolname\packagename.1
    :end
    First line just makes sure your flag file folder is there (call it what you want - if you use your school name then hopefully you'll remember what it's for :-))
    Next checks for a flag file; if it's there you just skip to the end (put whatever the package is called; you can then use the same idea for different packages)
    uninstall command exactly as before
    Next line creates a flag file and just puts the word "uninstalled" in it; the date stamp on the file will show you when it ran if you ever need to know.

    Why is there a ".1" at the end of the filename? Well, this allows you to just change it to ".2" when you need to remove this package and upgrade it (or when it all goes wrong and you need to do it a second time ...)

    Now you've got a startup script, you'll find there are loads of other things you can do and you'll wonder how you ever managed without :-)

  15. Thanks to srochford from:

    leco (21st July 2009)

  16. #13
    leco's Avatar
    Join Date
    Nov 2006
    Location
    West Yorkshire
    Posts
    2,026
    Thank Post
    595
    Thanked 125 Times in 119 Posts
    Rep Power
    41
    My learning never stops, there's always something else
    Tonight remotely, I've moved the uninstall script to the domain, started all the desktops and the software has gone from those machines, which I've now shut down. Tomorrow will be the turn of the laptops, there are more of those so may take some time to ensure all. Then I can move the startup script back to the test OU and try an edit as suggested.

    Next job, turn all machines back on to install the new software - this time in English

    Thanks for the continued assistance and support, it is very much appreciated.

SHARE:
+ Post New Thread

Similar Threads

  1. Happy Birthday World Wide Web (For Tomorrow)
    By FN-GM in forum General Chat
    Replies: 0
    Last Post: 11th November 2007, 02:27 PM
  2. Powerpoint & Wide Screen
    By FN-GM in forum General Chat
    Replies: 3
    Last Post: 29th September 2007, 09:22 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •