Good Monday Morning all!

In the scripts section of SW there are a number of great scripts for remotely identifying and uninstalling software… I was wondering if anyone knew of, or had a script that would identify and uninstall software network-wide, rather than per individual machine?

If anyone could point me in the right direction that’d be greeeeeeat :slight_smile:

…I know this isn’t Water Cooler material but didn’t know where to put it. Just figured this is where everyone hangs out as we have seen by everyone activity charts last week so thought this is my best chance of someone in the know seeing it!

cheers chaps!

9 Spice ups

If you found some scripts in the scripts section, then I’d have posted the question in the scripts section.

Just sayin’ :wink:

Do you want me to move it there?

1 Spice up

Any script that uninstalls software can be re-purposed to check local host and uninstall said software.

Use GPO (prefs maybe) to run it as a startup script.

1 Spice up

Ha, sorry I didn’t see a scripts section from the list available. Sure you can sling it in there if you think enough people actually view it!

Check this HTA utility.

http://community.spiceworks.com/scripts/show/915-remote-uninstall-software-hta

1 Spice up

Thanks Pushpak - I have been using this for a little while for small batches of uninstalls which led me onto the notion that there must be a way to uninstall software on all machines network-wide without having to do each machine manually.

Genus - that’s a good idea, thanks. I’ll take a look into using a GPO and remove said software.

Mea culpa. You can only add Scripts to the Script Center…

I’ll shift this to PowerShell :smiley:

1 Spice up

Thanks Huw :slight_smile:

Robin - PowerShell remoting is how you do this. Basically, with remoting, you can run a command, or a full script on any machine, and get the results back as though you were working locally.

1 Spice up

Hi TFL, thanks for the input. I am aware of the remote scripting abilities, I am enquiring more as to whether someone has or knows how to write a script to run through each machine on the network, and if it has software X installed, to uninstall it, then carry on automatically to the next machine etc etc.

Easy:

Something Like:

$comps = get-adcomputer -filter *
foreach ($comp in $comps) {
   If (get-swpackage) {remove-swpackage)
}

The get-swpackage and remove-swpackage are functions you supply to find out if a particular package is loaded and remove-swpackage removes it.

2 Spice ups

TFL is the man on this but this has always worked for me.

ADSI - ughhh. I prefer just to use Powerhell and not dive into ADSI.

Mileage varies!!

tfl - does get-swpackage and remove-swpackage come from a specific module? I don’t have them here as part of my 4.0 install.

So Twon put together a great script that pulls the uninstall application out of the registry and you could run the uninstaller either through PSExec or PowerShell Remoting (but remoting would have to be enabled on everything which isn’t trivial in itself).

The other options, and I shudder to suggest this , is you could use Win32_Product, once you have the software object there’s an uninstall() method.

you are totally correct and I have just updated all my scripts :slight_smile:

I believe those are pseudocode in TFL’s example, Rob. He said, “those are functions you supply.”

Twon’s script is pretty wizard, actually.

2 Spice ups

Ah - ok, I thought maybe he had some magic module he downloaded from somewhere that I wasn’t aware of…!

As it happens, I DO have some code that does indeed do this but it’s not production ready and I’m still playing, hence for this example, it’s just pseudo code.

For the OP - the way you remove some programs will differ - I lelft the details of how to do the actual removal and how you find the applications on each machine as an exercise for the reader!!!