/build/static/layout/Breadcrumb_cap_w.png

.bat to a .vbs?

First I would like to apologize for the simplicity of my question. I am new to scripting and trying to learn some vbs scripting. I created a vbs script to run the uninstall strings and delete a couple directories that failed misserably. So instead I have created a batch file to uninstall an application and delete two folders after the uninstall completes. (See below) I would prefer that this were a .vbs file but as I said earlier, I didn't have much luck. Can anybody assist with converting this script over to vbs?
Also is there a way to add some logic to the script so that it looks for registry key(s) and if it's not there it finishes without error so that I can chain it to an MSI install in SMS 2k3?

---

@ECHO OFF
REM All documents must be unlocked for the users before removing the Documentum "check out" folder. Confirm with development before uninstallation.
REM Sachin has a script to unlock documents - this must ran first.

REM Removes the Documentum Desktop Client 4.3
C:\WINDOWS\IsUninst.exe -y -x -a -fC:\PROGRA~1\DOCUME~1\DeIsL1.isu -c"C:\Program Files\Documentum\Shared\dmuninst.dll"

Rem removes the DCTM Runtime environment
C:\WINDOWS\IsUninst.exe -y -x -a -f"C:\Program Files\Documentum\DFCRE42\Uninst.isu"


REM Removes the Documentum Directories
rmdir /S/Q C:\Documentum
rmdir /S/Q "C:\Program Files\Documentum"

0 Comments   [ + ] Show comments

Answers (2)

Posted by: sclark 17 years ago
Senior Yellow Belt
0
Here was the .vbs script I made:

Set objWshShell = CreateObject("Wscript.Shell")

strUninstall = objWshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Documentum DFC Runtime Environment 4.2\UninstallString")

objWshShell.Run strUninstall & " -y -x -a"

strUninstall = objWshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Documentum Desktop Client 4.3\UninstallString")

objWshShell.Run strUninstall & " -y -x -a"

Set objWshShell = Nothing

On Error Resume Next
Dim fso, s
Set fso = CreateObject("Scripting.FileSystemObject")
s="C:\Documentum"
fso.deletefolder(s),True

On Error Resume Next
Dim fso, s
Set fso = CreateObject("Scripting.FileSystemObject")
s="C:\Program Files\Documentum"
fso.deletefolder(s),True
Posted by: sclark 17 years ago
Senior Yellow Belt
0
OK I think this actually worked? I am sure it's not very "clean" but it seems to be working? [:D]
thanks to realtimepublishers.com for the Administrators Shortcut Guide to VBScripting for WIndows!
Even though it seems to be working, Any advice an imporving on it is certainly welcome.

Set objWshShell = CreateObject("Wscript.Shell")

strUninstall = objWshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Documentum DFC Runtime Environment 4.2\UninstallString")

objWshShell.Run strUninstall & " -y -x -a"

strUninstall = objWshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Documentum Desktop Client 4.3\UninstallString")

objWshShell.Run strUninstall & " -y -x -a"

On Error Resume Next
Dim fso, s
Set fso = CreateObject("Scripting.FileSystemObject")
s="C:\Documentum"
fso.deletefolder(s),True

On Error Resume Next
Dim fso1, sFolder
Set fso1 = CreateObject("Scripting.FileSystemObject")
sFolder="C:\Program Files\Documentum"
fso.deletefolder(s),True

Set objWshShell = Nothing
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ