Solved

script to uninstall multiple software

Posted on 2010-09-23
54
1,054 Views
Last Modified: 2012-05-10
Hi,
I want to uninstall multiple software from 100s of servers. I need script to uninstall softwares without reboot all servers.
Software Name and Registry Values are as under.

1)  CentraOne
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CentraOneClient
2)  EwM Forecast Scheduler 5.00.0850 | 5.00.0850
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EWM Forecast Scheduler 5.00.0850
3)  Roxio Audio Module | 2.0.4
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AB708C9B-97C8-4AC9-899B-DBF226AC9382}
4)  Roxio CinePlayer | 2.3.0
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26792CA7-D87A-4DBE-896B-C2F66B344511}
5)  Roxio Copy Module | 2.0.4
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B12665F4-4E93-4AB4-B7FC-37053B524629}
6)  Roxio Data Module | 2.0.4
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{075473F5-846A-448B-BCB3-104AA1760205}
7)  Roxio Express Labeler | 2.0.0
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA}
8)  Roxio MyDVD Plus | 6.1.3
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{21657574-BD54-48A2-9450-EB03B2C7FC29}
9)  Roxio Update Manager | 3.0.0
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{30465B6C-B53F-49A1-9EBA-A3F187AD502E}
10) Symantec Ghost Console And Standard Toos | 83.00.1331
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010}

Please let me know if there is other way to do it.
Thanks
Izhar
0
Comment
Question by:izharkhan
  • 26
  • 20
  • 5
  • +2
54 Comments
 
LVL 6

Expert Comment

by:dax_bad
ID: 33747990
Hey,

Check out this post
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24495756.html

It looks like you've got the GUID's needed for most of them, except the 2 top ones.

Hope that helps

Cheers
Daniel
0
 
LVL 11

Expert Comment

by:farjadarshad
ID: 33750954
To uninstall a software on your own machine

wmic product where name="MobileMe Control Panel" call uninstall

or if you want to uninstall a program form remote system use following

wmic /node:EXAMPLE product where name="MobileMe Control Panel" call uninstall

where EXAMPLE is the name of remote pc and MobileMe Control Panel is the software

you can type the above line multiple times in a notepad file and you just have to change the software name save this file with any name but the extension should be .cmd or .bat then run it
0
 
LVL 5

Expert Comment

by:rov17
ID: 33753230
Hi,
You can put the below command line in a batch file:
 

start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{26792CA7-D87A-4DBE-896B-C2F66B344511} ALLUSERS=TRUE REBOOT=SUPPRESS /QB


and add the rest od the GUID,
The /wait switch will let you do multiple un installation in the same batch file, as soon as the first one finish the second un installation will start then the 3 and the 4....

start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{26792CA7-D87A-4DBE-896B-C2F66B344511} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:izharkhan
ID: 33757061
Hi Rov,
I dont know much about scripting. If you can put script over here it will really help me
Thanks
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 33758916
Hi, izharkhan, under each of those keys, you should also find an "UninstallString" value.  You can copy those lines into a batch file, and just run that, and it should do the job.  If they use MSIExec, add the /qn and /norestart switches if they're not in them already.

Regards,

Rob.
0
 

Author Comment

by:izharkhan
ID: 33758925
can you explain little more with example if possible. I am new to this things and learning. so if you can help me...:)
Thanks
0
 
LVL 5

Expert Comment

by:rov17
ID: 33758967
Hi izharkhan,

there is the code copy it to a notepad file then rename the ext as .bat

you need to get the GUID for the first 2 software or the UninstallString as you did with the rest, just copy the same command and only replace the GULD with those 2 programs, if you not sure send it and I will add for you.
start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

and for Rob you have to use the /wait switch otherwise all the un installation will try to run at the same time and it start to give you errors that there is already installation running.

Regards

start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{26792CA7-D87A-4DBE-896B-C2F66B344511} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{B12665F4-4E93-4AB4-B7FC-37053B524629} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{075473F5-846A-448B-BCB3-104AA1760205} ALLUSERS=TRUE REBOOT=SUPPRESS /QB


start /wait MSIEXEC /x{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{21657574-BD54-48A2-9450-EB03B2C7FC29} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{30465B6C-B53F-49A1-9EBA-A3F187AD502E} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

Open in new window

0
 
LVL 65

Expert Comment

by:RobSampson
ID: 33758975
OK, run this script, which will read the Uninstall string for each app, and write them to a batch file you.  You can then examine that batch file, and see whether you need to add the /qn and /norestart switches.  It won't run the batch file just yet, we just want to see if it's correct.

Regards,

Rob.
arrUninstalls = Array( _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CentraOneClient\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EWM Forecast Scheduler 5.00.0850\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AB708C9B-97C8-4AC9-899B-DBF226AC9382}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26792CA7-D87A-4DBE-896B-C2F66B344511}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B12665F4-4E93-4AB4-B7FC-37053B524629}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{075473F5-846A-448B-BCB3-104AA1760205}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{21657574-BD54-48A2-9450-EB03B2C7FC29}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{30465B6C-B53F-49A1-9EBA-A3F187AD502E}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010}\UninstallString" _
	)

strBatchFile = "C:\Temp\UninstallApps.bat"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objBatch = objFSO.CreateTextFile(strBatchFile)
Set objShell = CreateObject("WScript.Shell")
For Each strApp In arrUninstalls
	On Error Resume Next
	strUninstall = objShell.RegRead(strApp)
	If Err.Number = 0 Then
		On Error GoTo 0
		objBatch.WriteLine strUninstall
	Else
		Err.Clear
		WScript.Echo "No UninstallString for " & strApp
		On Error GoTo 0
	End If
Next
objBatch.Close
objShell.Run "notepad " & strBatchFile, 1, False

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33765883
Hi Rov,
for first 2 software i couldnt find the GUID. and after make .bat file. what i have to do next? how i can run this for 100s of servers???????
0
 

Author Comment

by:izharkhan
ID: 33765891
Hi Rob,
This file i will run tomorrow morning first and let you guys know what will happen
Thanks
0
 

Author Comment

by:izharkhan
ID: 33769865
Hi Rov,
I run .bat file for one server and its working fine. Now i need to know how it can work for multiple servers. because i want to remove these softwares from  more then 1000 servers....Please help me.
Thanks
Izhar
0
 
LVL 5

Expert Comment

by:rov17
ID: 33769997
Do u have a list of those servers?
I will create u 8 batches for the 8 uninstallation, those 8 batches will run on all of the servers. Will send u the templet in z morning
0
 

Author Comment

by:izharkhan
ID: 33770118
Yes i do have all Servers lists. Please send me those so i can do it. and also i need to know GUID for first 2 software. I couldnt find that. If you can find it as well.
Thanks
Izhar
0
 
LVL 5

Expert Comment

by:rov17
ID: 33777230
Add the servers names to a text file named computerlist.txt, one per line.  Then paste the script below into a different text file with a .cmd extension.  Running the .cmd file should uninstall those 8 SW from all of the machines.

You need to run the .cmd file as an administrator

@echo off
setlocal
 

for /F %%G in (computerlist.txt) do (
 start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{26792CA7-D87A-4DBE-896B-C2F66B344511} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{B12665F4-4E93-4AB4-B7FC-37053B524629} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{075473F5-846A-448B-BCB3-104AA1760205} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{21657574-BD54-48A2-9450-EB03B2C7FC29} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{30465B6C-B53F-49A1-9EBA-A3F187AD502E} ALLUSERS=TRUE REBOOT=SUPPRESS /QB

start /wait MSIEXEC /x{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010} ALLUSERS=TRUE REBOOT=SUPPRESS /QB
)

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33778792
Hi Rov,
I am trying to run that script and if it cant find that software in server its give everytime error message that "This action is only valid for Products that are currently installed." i just need that if that software is not there its just skip and run another one. otherwise i have to press everytime enter to clear error and for 1000s servers its not possible. if you can help me
Thanks
Izhar
0
 
LVL 5

Expert Comment

by:rov17
ID: 33778929
Try the one below, save it as .cmd file and run it instead of the previous one (it put any error into a log file and will be saved on the C drive)

Cheers
@echo off
setlocal
 

for /F %%G in (computerlist.txt) do (
 start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log1.txt

start /wait MSIEXEC /x{26792CA7-D87A-4DBE-896B-C2F66B344511} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log2.txt

start /wait MSIEXEC /x{B12665F4-4E93-4AB4-B7FC-37053B524629} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log3.txt

start /wait MSIEXEC /x{075473F5-846A-448B-BCB3-104AA1760205} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log4.txt

start /wait MSIEXEC /x{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log5.txt

start /wait MSIEXEC /x{21657574-BD54-48A2-9450-EB03B2C7FC29} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log6.txt

start /wait MSIEXEC /x{30465B6C-B53F-49A1-9EBA-A3F187AD502E} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log7.txt

start /wait MSIEXEC /x{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log8.txt
)

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33779072
actually script working fine. but if out of 8 6 software not there in servers. everytime its give that error and i have to click everytime ok. i also going to put screenshot.
i wanna run this for 1000 servers so many servers may not have these softwares then how we can do that
1.bmp
0
 
LVL 5

Expert Comment

by:rov17
ID: 33779231
Have you tried the second script? It is the same Syntax I just added an output file for any error so it doesn't prompt you.
0
 

Author Comment

by:izharkhan
ID: 33779331
I tried second one and this screenshot is from second script. its not error adn all error text files are empty..... its just cant find that software thats why gives error. I run this script to one of server who has all softwares install. and this script run perfect without giving any error. is that any way that we can skip this error?
Thanks
0
 
LVL 5

Expert Comment

by:rov17
ID: 33779642
mmm try this one then
@echo off
setlocal
 

for /F %%G in (computerlist.txt) do (
 start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log1.txt

if %errorlevel%==0 goto OK

:OK
start /wait MSIEXEC /x{26792CA7-D87A-4DBE-896B-C2F66B344511} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log2.txt

if %errorlevel%==0 goto OK

:OK
start /wait MSIEXEC /x{B12665F4-4E93-4AB4-B7FC-37053B524629} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log3.txt

if %errorlevel%==0 goto OK

:OK
start /wait MSIEXEC /x{075473F5-846A-448B-BCB3-104AA1760205} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log4.txt

if %errorlevel%==0 goto OK

:OK
start /wait MSIEXEC /x{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log5.txt

if %errorlevel%==0 goto OK

:OK
start /wait MSIEXEC /x{21657574-BD54-48A2-9450-EB03B2C7FC29} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log6.txt

if %errorlevel%==0 goto OK

:OK
start /wait MSIEXEC /x{30465B6C-B53F-49A1-9EBA-A3F187AD502E} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log7.txt

if %errorlevel%==0 goto OK

:OK
start /wait MSIEXEC /x{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010} ALLUSERS=TRUE REBOOT=SUPPRESS /QB >> c:\log8.txt
)

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33779869
I tried this script too same error message and this one not running for other servers too. means not taking other servers from text.... can you please check this one again
0
 
LVL 5

Expert Comment

by:rov17
ID: 33787236
This will work!
Cheers
@echo off
setlocal
 

for /F %%G in (computerlist.txt) do (
 start /wait MSIEXEC /x{AB708C9B-97C8-4AC9-899B-DBF226AC9382} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

start /wait MSIEXEC /x{26792CA7-D87A-4DBE-896B-C2F66B344511} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

start /wait MSIEXEC /x{B12665F4-4E93-4AB4-B7FC-37053B524629} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

start /wait MSIEXEC /x{075473F5-846A-448B-BCB3-104AA1760205} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

start /wait MSIEXEC /x{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

start /wait MSIEXEC /x{21657574-BD54-48A2-9450-EB03B2C7FC29} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

start /wait MSIEXEC /x{30465B6C-B53F-49A1-9EBA-A3F187AD502E} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

start /wait MSIEXEC /x{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010} ALLUSERS=TRUE REBOOT=SUPPRESS /QN
)

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33789231
Hey Rov,
What about 2 other softwares. I didnt find keys for those 2 softwares. how can we remove those 2 softwares????
0
 
LVL 5

Expert Comment

by:rov17
ID: 33798099
Can you send me the SW and it is ver, you usually can find that by opening the program then help about...

Has the last script worked without displaying you the errors?
0
 

Author Comment

by:izharkhan
ID: 33798161
he rov,
For EWM Forcast its 5.00.0850
but i cant open centraone.....

also i need final report that shows that softwares are remove from server. how can we do that?
0
 
LVL 5

Expert Comment

by:rov17
ID: 33798245
Try to look up that centraone in the registy and see if it gonna show u any thing.
Have u tried to run the last script that I posted?
If u only tested without running it on all z servers we can add an out put in it.
0
 
LVL 5

Expert Comment

by:rov17
ID: 33798261
Try to look up that centraone in the registy and see if it gonna show u any thing.
Have u tried to run the last script that I posted?
If u only tested without running it on all z servers we can add an out put in it.
0
 

Author Comment

by:izharkhan
ID: 33798419
yes i tried that script in 2 testing servers and its run without any error.
i still didnt run that in all servers so if you can change it.
I am trying to get that software version well its not allowing me to get but  we can try 7.2.0.40.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 33804517
Please try this VBS to create your batch files.  It will connect to the registry on each server in servers.txt, and check *that* registry for the existence of the uninstall keys, so if the software doesn't exist there, it won't *try* to uninstall it.  The batch files will be called
<servername>_UninstallApps.bat

Regards,

Rob.
arrUninstalls = Array( _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CentraOneClient\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EWM Forecast Scheduler 5.00.0850\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AB708C9B-97C8-4AC9-899B-DBF226AC9382}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26792CA7-D87A-4DBE-896B-C2F66B344511}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B12665F4-4E93-4AB4-B7FC-37053B524629}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{075473F5-846A-448B-BCB3-104AA1760205}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{21657574-BD54-48A2-9450-EB03B2C7FC29}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{30465B6C-B53F-49A1-9EBA-A3F187AD502E}\UninstallString", _
	"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010}\UninstallString" _
	)

strServers = "servers.txt"

Const HKEY_LOCAL_MACHINE = &H80000002
Const HKLM = &H80000002

Set objFSO = CreateObject("Scripting.FileSystemObject")
Const intForReading = 1
Set objShell = CreateObject("WScript.Shell")

Set objServers = objFSO.OpenTextFile(strServers, intForReading, False)
While Not objServers.AtEndOfStream
	strServer = objServers.ReadLine
	If Ping(strServer) = True Then
		On Error Resume Next
		Set objRegistry = GetObject("winmgmts:\\" & strServer & "\root\default:StdRegProv")
		If Err.Number = 0 Then
			On Error GoTo 0
			strBatchFile = "UninstallApps_" & strServer & ".bat"
			Set objBatch = objFSO.CreateTextFile(strBatchFile)
			For Each strApp In arrUninstalls
				strRoot = Eval(Left(strApp, InStr(strApp, "\") - 1))
				strKeyPath = Mid(strApp, InStr(strApp, "\") + 1)
				strKeyPath = Left(strKeyPath, InStrRev(strKeyPath, "\"))
				If Right(strApp, 1) <> "\" Then
					strValueName = Mid(strApp, InStrRev(strApp, "\") + 1)
				Else
					strValueName = ""
				End If
				intReturn = objRegistry.GetStringValue(strRoot, strKeyPath, strValueName, strValueData)
				If intReturn = 0 Then
					objBatch.WriteLine strValueData
				Else
					'WScript.Echo "No UninstallString for " & strApp & " on " & strServer
					objBatch.WriteLine "REM No UninstallString for " & strApp & " on " & strServer
				End If
			Next
			objBatch.Close
			'objShell.Run "notepad " & strBatchFile, 1, False
		Else
			WScript.Echo strServer & " WMI Error. Error " & Err.Number & ": " & Err.Description
			Err.Clear
			On Error GoTo 0
		End If
	Else
		WScript.Echo strServer & " is offline."
	End If
Wend
objServers.Close

WScript.Echo "Batch files have been created."

Function Ping(strComputer)
	Dim objShell, boolCode
	Set objShell = CreateObject("WScript.Shell")
	boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
	If boolCode = 0 Then
		Ping = True
	Else
		Ping = False
	End If
End Function

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33808184
Hey Rob,
Nice to see you here :)
I tried your script. when i try to run it. it didnt uninstall any software and even not taking next server...
its just give command screen and gone. Can you please modify it.
Thanks
0
 

Author Comment

by:izharkhan
ID: 33808190
Hey Rov,
Did you get time to work on it :)
please let me know
Thanks
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 33812460
All the script does as the moment, is create individual batch files, one per server, that you can run *from* that server with the same name as the batch file, to start uninstalling the software.

Once you have a batch file or two created, from the list of servers in your servers.txt file, you can test the specific batch file on that server.  For example, if you have
MYSERVER1
in servers.txt, and you run the VBS code above, then in the same folder as the VBS, you will see it creates
UninstallApps_MYSERVER1.bat

So, go to the MYSERVER1 server, and run the UninstallApps_MYSERVER1.bat, and it should start uninstalling whatever is in the batch file.

You should not run UninstallApps_MYSERVER1.bat on a server with a different name, because those applications in the batch file might not exist on the other server.

Regards,

Rob.
0
 
LVL 5

Expert Comment

by:rov17
ID: 33812585
Hi,

Do you how those 2 SW were installed? Was it those MSI or EXE? Do you still have the setup file?
As we don’t have the GUID for those two we will be uninstalling them with their setup file, put the content of the SW CD in a folder and share it \\myserver\MyShare
And run the below script on a test server  (the script will check if that setup exe or msi installed on the test server then it will start to un install it)
I have put 2 command one for MSI and the other for exe (if the SW was installed via msi use the frist command , if it was installed via exe use the second, or send me the name of those setup and I will modify the script for you)
Below is a script for that

So if that worked fine, uou will should be running 2 batchs one for the 8 SW and the second for the 2 SW.

Cheers
ECHO UN Installing First SW..
ECHO Please Wait
start /wait MSIEXEC /X " "\\Myserver\MyShare\SWsetup.MSI" ALLUSERS=TRUE REBOOT=SUPPRESS /QB
 
ECHO UN Installing Second SW
ECHO Please wait...
start /wait \\Myserver\MyShare\SWsetup.exe /x /s /v"/qn ADDLOCAL=jrecore IEXPLORER=1 MOZILLA=1"

Open in new window

0
 
LVL 5

Expert Comment

by:rov17
ID: 33812596
Forgot to mention if the 2 SW script worked fine for you on a test server, let me know so I can modify it to run on that all servers list.txt as I did with the first script.

Cheers
0
 

Author Comment

by:izharkhan
ID: 33815924
Hey Rob,
Thanks a lot for your comment. let me try this on test servers on monday. i just need to ask one thing while it will uninstall software it will do everything without user interaction right?
0
 

Author Comment

by:izharkhan
ID: 33815926
Hey Rov,
Thanks a lot for your comment. i will try this on monday and let you know it will work or not. and once it will work then please modify it for all servers.
Thanks
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 33816733
>>  it will do everything without user interaction right?

Only if the uninstall program supports a silent installation.  Some applications that are installed by an EXE (and do not use MSIExec) do not support a silent uninstall.  All of the MSIExec based uninstalls should though.  If you edit one of the batch files, check if the MSIExec uninstalls have the /qn and /norestart switches.  If they don't you can add those manually for testing, but we can make the script add those.

If there any uninstalls (like Centra One) that use an EXE, you might be able to add a /s or /q switch to those, but you will need to test what will work.

Regards,

Rob.
0
 

Author Comment

by:izharkhan
ID: 33822516
Hi Rob,
Hope you doing well.
I tried to run script and its created 2 batch file. I went to that server and run it. It uninstalled centraone perfectly but still its not working for EWM Forecast. Also now if i want to uninstall to all servers how can i run this script to uninstall  from all servers...becaz it create one batch file for one server. If i want to run this for servers then how can i do that.
Thanks
Izhar
0
 

Author Comment

by:izharkhan
ID: 33823316
Hey Rob,
few things to discuss.
 I run this script in 5 servers. I make a servers.txt and run.
 Only 1 server create a batch file for name uninstallapp_myserver.bat
when i run this batch file for same server it deleted software but asked me to uninstall for centraone and for ewm it uninstall but it didnt delete shortcut on servers.

Now my questin is......

IF i want to run this script for all servers how i can run becaz it works only on one server and create batch file. what about other servers?
why it didnt clean shortcuts and everything  for ewm
and for centraone i have to manually click on uninstall things.

can you please let me know what i can do for it?

Thanks in advance
Regards
izhar
0
 

Author Comment

by:izharkhan
ID: 33823393
Rob,
This is output for batch file. in this server all 8 softwares i already deleted. this is for first 2 softwares
Thanks

C:\PROGRA~1\CENTRA~1\bin\launcher.exe uninstall
D:\PROGRA~1\EWM\UNWISE.EXE D:\PROGRA~1\EWM\INSTALL.LOG
REM No UninstallString for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AB708C9B-97C8-4AC9-899B-DBF226AC9382}\UninstallString on S9993S01
REM No UninstallString for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26792CA7-D87A-4DBE-896B-C2F66B344511}\UninstallString on S9993S01
REM No UninstallString for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B12665F4-4E93-4AB4-B7FC-37053B524629}\UninstallString on S9993S01
REM No UninstallString for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{075473F5-846A-448B-BCB3-104AA1760205}\UninstallString on S9993S01
REM No UninstallString for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6675CA7F-E51B-4F6A-99D4-F8F0124C6EAA}\UninstallString on S9993S01
REM No UninstallString for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{21657574-BD54-48A2-9450-EB03B2C7FC29}\UninstallString on S9993S01
REM No UninstallString for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{30465B6C-B53F-49A1-9EBA-A3F187AD502E}\UninstallString on S9993S01
MsiExec.exe /I{B8C29E2A-23D3-48BF-0B1E-5F3EFABF1010}
0
 

Author Comment

by:izharkhan
ID: 33823845
HI ROV,
I was trying your script.......well for  8 softwares its work perfect for all servers without any error.......thankssss

now testing time....
I am attaching some screen shots please check it. i tried to run this batch file but it didnt uninstall.

can you please advice?
Thanks
Izhar
1.bmp
3.bmp
0
 
LVL 5

Expert Comment

by:rov17
ID: 33837354
Hi,

Try this one for centraone, and if that worked will modify the batch to run on the serverlist.txt
Or I can get Rob batch that unistalled centraone to work on the same txt list.
also can you post that install.log file for EWM.

Cheers
ECHO UN Installing First SW..
ECHO Please Wait

start /wait "C:\Program Files\centraone\bin\launcher.exe" /x /s /v"/qn ADDLOCAL=jrecore IEXPLORER=1 MOZILLA=1"

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33840258
Hi Rov,
I run this one and its shows that invalid switch - "/x"
also i am attaching log file for your ref.
Thanks
INSTALL.LOG
0
 
LVL 5

Expert Comment

by:rov17
ID: 33848554
Try this batch for EWM


start /wait MSIEXEC /x{34659A29-1B2D-425C-BB17-49F135E1FD47} ALLUSERS=TRUE REBOOT=SUPPRESS /QN

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33861673
Hey Rov,
Thanks I will try this when i will be in office. and let you know result hope this will work :)
thanks again
Izhar
0
 

Author Comment

by:izharkhan
ID: 33886726
Hey Rov,
I tried that command but its not working. well we can do one thing....
When I run this command on server it will uninstall both of softwares

C:\PROGRA~1\CENTRA~1\bin\launcher.exe uninstall
D:\PROGRA~1\EWM\UNWISE.EXE D:\PROGRA~1\EWM\INSTALL.LOG

can we run this command to multiple servers? if we can we will be ok.........
This one i got from mr ROB vbscript, he is busy till that we can use this lol......
please let me know how can we do that
Thanks

0
 
LVL 5

Expert Comment

by:rov17
ID: 33923437
Add the server’s names to a text file named computerlist.txt, one per line.  Then paste the two script below into a different text file with a .cmd extension.  

You need to run the .cmd file as an administrator

The first batch should un install CENTRA..
And the other batch for EWM

@echo off
setlocal
 
for /F %%G in (computerlist.txt) do (

C:\PROGRA~1\CENTRA~1\bin\launcher.exe uninstall

Open in new window

0
 
LVL 5

Expert Comment

by:rov17
ID: 33923439
EWM batch is the following
@echo off
setlocal
 
for /F %%G in (computerlist.txt) do (

D:\PROGRA~1\EWM\UNWISE.EXE D:\PROGRA~1\EWM\INSTALL.LOG

Open in new window

0
 
LVL 5

Expert Comment

by:rov17
ID: 33923450
sorry it sould be as the following:
@echo off
setlocal
 
for /F %%G in (computerlist.txt) do (
C:\PROGRA~1\CENTRA~1\bin\launcher.exe uninstall
)

Open in new window

0
 
LVL 5

Expert Comment

by:rov17
ID: 33923460

@echo off
setlocal
 
for /F %%G in (computerlist.txt) do (

D:\PROGRA~1\EWM\UNWISE.EXE D:\PROGRA~1\EWM\INSTALL.LOG
)

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33931928
Brother Rov,
I tried both script but still its just uninstalling in server which i run script.....
I run both script in test server and its just uninstalled software in which server i run script.
Can you modify or try something else please. I know i am giving you hard time but only you can help me :)
Thanks
Izhar
0
 
LVL 5

Accepted Solution

by:
rov17 earned 500 total points
ID: 33936248
Download psexec then put in on the c drive with the uninstallBatch.cmd and the computerlist.txt

Save the below command into a txt file and save it as .cmd in the save location c:\

Run that last batch it should work.


@echo off
 
psexec @C:\TEMP\computerlist.txt -u MyDomain\Username -c c:\uninstallBatch.cmd

Open in new window

0
 

Author Comment

by:izharkhan
ID: 33940886
Hey Rov,
I tried this one also its still on one server. for  centraone software its giving error message that " class not register" and also i run psexec its just show below screen.
Please let me know other posibilities.
Thanks
Izhar
1.bmp
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question