Need script to run msiesec, remove service,delete files. and delete regkey.

I need a VB script to run these commands in this order.
1. run msiexec /q /x  \\servername\sharename\dwmrcs.msi
2. must stop and remove service
  sc stop dwmrcs
  sc delete dwmrcs
3. delete these files from %systemroot%\system32
  dwrcs.exe
  dwrck.dll
  dwrcset.dll
  dwrcshell.dll
  dwrcs.ini
4. Delete Key "DameWare Development" from HLCU\software and HKLM\software.

This must all be done quiet with no output to the enduser. resumes on errors.

Thanks guys and girls
Jason
LVL 1
jasonlkennedyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
RobSampsonConnect With a Mentor Commented:
Or, to even put the whole thing in one VBS (kind of cheating though, but why re-invent the wheel?):

'=====================
Set objShell = CreateObject("WScript.Shell")
strCommand = "msiexec /q /x \\servername\sharename\dwmrcs.msi"
objShell.Run strCommand, 0, True
strCommand = "cmd /c sc stop dwmrcs"
objShell.Run strCommand, 0, True
strCommand = "cmd /c sc delete dwmrcs"
objShell.Run strCommand, 0, True
strCommand = "cmd /c del /q /f %systemroot%\system32\dwrcs.exe"
objShell.Run strCommand, 0, True
strCommand = "cmd /c del /q /f %systemroot%\system32\dwrck.dll"
objShell.Run strCommand, 0, True
strCommand = "cmd /c del /q /f %systemroot%\system32\dwrcset.dll"
objShell.Run strCommand, 0, True
strCommand = "cmd /c del /q /f %systemroot%\system32\dwrcshell.dll"
objShell.Run strCommand, 0, True
strCommand = "cmd /c del /q /f %systemroot%\system32\dwrcs.ini"
objShell.Run strCommand, 0, True
strCommand = "cmd /c reg delete /f ""HLCU\software and HKLM\software\DameWare Development"""
objShell.Run strCommand, 0, True
Set objShell = Nothing
'===================

Regards,

Rob.
0
 
RobSampsonCommented:
What about a batch file:

@echo off
msiexec /q /x  \\servername\sharename\dwmrcs.msi
sc stop dwmrcs
sc delete dwmrcs
del /q /f %systemroot%\system32\dwrcs.exe
del /q /f %systemroot%\system32\dwrck.dll
del /q /f %systemroot%\system32\dwrcset.dll
del /q /f %systemroot%\system32\dwrcshell.dll
del /q /f %systemroot%\system32\dwrcs.ini
reg delete /f "HLCU\software and HKLM\software\DameWare Development"


Regards,

Rob.
0
 
RobSampsonCommented:
Oh, this:
reg delete /f "HLCU\software and HKLM\software\DameWare Development"

should be
reg delete /f "HLCU\software\DameWare Development"
reg delete /f "HKLM\software\DameWare Development"

Regards,

Rob.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
hlarseCommented:
Here's how to make it silent.  Check out nircmdc.exe at www.nirsoft.net and include this at the top of your batch file

@echo off
cls
setlocal
cd /d c:\windows
if not exist "c:\windows\nircmd.exe" copy "\\server\share\nircmd.exe" >nul 2>nul
nircmdc.exe win min ititle cmd.exe
0
 
RobSampsonCommented:
Oh yeah, or you can use a VBS file to run the batch file silently too:

Set objShell = CreateObject("WScript.Shell")
strBatchPath = "C:\Temp\BatchFile.bat"
objShell.Run strBatchFile, 0, True

It's the zero there that hides the command window.

Regards,

Rob.
0
 
jasonlkennedyAuthor Commented:
Fast and accurate.. Thanks.
0
 
RobSampsonCommented:
Thanks for the grade.

Regards,

Rob.
0
All Courses

From novice to tech pro — start learning today.