Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - vbscript registry exist then......

Reply
 
Old 09-23-2008   #1 (permalink)
deen


 
 

vbscript registry exist then......

Please help urgent request


PLease help with VBScript
ive tried 2 ways they both dont wort, can you tell me where i;m going
wrong rahter than email me script i dont understand.

thanks


set WshShell = WScript.CreateObject("WScript.Shell")

strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
\RMS63\uninstallRMS6.bat"

Function RegistryItemExists (RegistryItem)

If RegistryItemExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
\CurrentVersion\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\")
then

WSHShell.Run strUninstallRMS6, 1 , FALSE

end if

WScript.sleep 30000

WScript.Quit


=================================================================

set WshShell = WScript.CreateObject("WScript.Shell")

strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
\RMS63\uninstallRMS6.bat"


If WshShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\") = true Then
WSHShell.Run strUninstallRMS6, 1 , FALSE

End If
WScript.sleep 30000

WScript.Quit

===================================================================

Please help urgent request.
simple explanation

many thanks





My System SpecsSystem Spec
Old 09-23-2008   #2 (permalink)
Tom Lavedas


 
 

Re: vbscript registry exist then......

On Sep 23, 12:05*pm, deen <an...@xxxxxx> wrote:
Quote:

> Please help urgent request
>
> PLease help with VBScript
> ive tried 2 ways they both dont wort, can you tell me where i;m going
> wrong rahter than email me script i dont understand.
>
> thanks
>
> set WshShell = WScript.CreateObject("WScript.Shell")
>
> strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> \RMS63\uninstallRMS6.bat"
>
> Function RegistryItemExists (RegistryItem)
>
> If RegistryItemExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
> \CurrentVersion\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\")
> then
>
> WSHShell.Run strUninstallRMS6, 1 , FALSE
>
> end if
>
> WScript.sleep 30000
>
> WScript.Quit
>
> =================================================================
>
> set WshShell = WScript.CreateObject("WScript.Shell")
>
> strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> \RMS63\uninstallRMS6.bat"
>
> If WshShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
> \Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\") = true Then
> WSHShell.Run strUninstallRMS6, 1 , FALSE
>
> End If
> WScript.sleep 30000
>
> WScript.Quit
>
> ===================================================================
>
> Please help urgent request.
> simple explanation
>
> many thanks
Using the WSH registry items, the only way to test for the presence/
absence of a key is to test for the success or failure of the RegRead
method, something like this ...

strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS" _
& "\RMS63\uninstallRMS6.bat"
sKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" _
& "\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\"
if CStr(CheckRegKey(sKey)) then
set WshShell = CreateObject("WScript.Shell")
WSHShell.Run strUninstallRMS6, 1 , FALSE
end if

Function CheckRegKey(sKey)
On Error Resume next
with CreateObject("WScript.Shell")
.RegRead sKey
end with
CheckRegKey = (Err.Number = 0)
On Error Goto 0
end function

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
My System SpecsSystem Spec
Old 09-24-2008   #3 (permalink)
deen


 
 

Re: vbscript registry exist then......

On 23 Sep, 17:38, Tom Lavedas <tglba...@xxxxxx> wrote:
Quote:

> On Sep 23, 12:05*pm, deen <an...@xxxxxx> wrote:
>
>
>
>
>
Quote:

> > Please help urgent request
>
Quote:

> > PLease help with VBScript
> > ive tried 2 ways they both dont wort, can you tell me where i;m going
> > wrong rahter than email me script i dont understand.
>
Quote:

> > thanks
>
Quote:

> > set WshShell = WScript.CreateObject("WScript.Shell")
>
Quote:

> > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> > \RMS63\uninstallRMS6.bat"
>
Quote:

> > Function RegistryItemExists (RegistryItem)
>
Quote:

> > If RegistryItemExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
> > \CurrentVersion\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\")
> > then
>
Quote:

> > WSHShell.Run strUninstallRMS6, 1 , FALSE
>
Quote:

> > end if
>
Quote:

> > WScript.sleep 30000
>
Quote:

> > WScript.Quit
>
Quote:

> > =================================================================
>
Quote:

> > set WshShell = WScript.CreateObject("WScript.Shell")
>
Quote:

> > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> > \RMS63\uninstallRMS6.bat"
>
Quote:

> > If WshShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
> > \Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\") = true Then
> > WSHShell.Run strUninstallRMS6, 1 , FALSE
>
Quote:

> > End If
> > WScript.sleep 30000
>
Quote:

> > WScript.Quit
>
Quote:

> > ===================================================================
>
Quote:

> > Please help urgent request.
> > simple explanation
>
Quote:

> > many thanks
>
> Using the WSH registry items, the only way to test for the presence/
> absence of a key is to test for the success or failure of the RegRead
> method, something like this ...
>
> strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS" _
> * * * * * * * * *& "\RMS63\uninstallRMS6.bat"
> sKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" _
> * * *& "\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\"
> if CStr(CheckRegKey(sKey)) then
> * set WshShell = CreateObject("WScript.Shell")
> * WSHShell.Run strUninstallRMS6, 1 , FALSE
> end if
>
> Function CheckRegKey(sKey)
> * On Error Resume next
> * * with CreateObject("WScript.Shell")
> * * * .RegRead sKey
> * * end with
> * * CheckRegKey = (Err.Number = 0)
> * On Error Goto 0
> end function
>
> Tom Lavedas
> ===========http://members.cox.net/tglbatch/wsh/- Hide quoted text -
>
> - Show quoted text -
Hi

Thankyou very much for your answers. Unfortunately when i run the
script as a .vbs nothing happens. the key is not removed.
i have confirmed the key "{264600DE-0879-4231-9F93-9CE3D503DFC1}"
diffenatelty exist.

thankyou very much
My System SpecsSystem Spec
Old 09-24-2008   #4 (permalink)
deen


 
 

Re: vbscript registry exist then......

On 24 Sep, 09:49, deen <an...@xxxxxx> wrote:
Quote:

> On 23 Sep, 17:38, Tom Lavedas <tglba...@xxxxxx> wrote:
>
>
>
>
>
Quote:

> > On Sep 23, 12:05*pm, deen <an...@xxxxxx> wrote:
>
Quote:
Quote:

> > > Please help urgent request
>
Quote:
Quote:

> > > PLease help with VBScript
> > > ive tried 2 ways they both dont wort, can you tell me where i;m going
> > > wrong rahter than email me script i dont understand.
>
Quote:
Quote:

> > > thanks
>
Quote:
Quote:

> > > set WshShell = WScript.CreateObject("WScript.Shell")
>
Quote:
Quote:

> > > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> > > \RMS63\uninstallRMS6.bat"
>
Quote:
Quote:

> > > Function RegistryItemExists (RegistryItem)
>
Quote:
Quote:

> > > If RegistryItemExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
> > > \CurrentVersion\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\")
> > > then
>
Quote:
Quote:

> > > WSHShell.Run strUninstallRMS6, 1 , FALSE
>
Quote:
Quote:

> > > end if
>
Quote:
Quote:

> > > WScript.sleep 30000
>
Quote:
Quote:

> > > WScript.Quit
>
Quote:
Quote:

> > > =================================================================
>
Quote:
Quote:

> > > set WshShell = WScript.CreateObject("WScript.Shell")
>
Quote:
Quote:

> > > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> > > \RMS63\uninstallRMS6.bat"
>
Quote:
Quote:

> > > If WshShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
> > > \Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\") = true Then
> > > WSHShell.Run strUninstallRMS6, 1 , FALSE
>
Quote:
Quote:

> > > End If
> > > WScript.sleep 30000
>
Quote:
Quote:

> > > WScript.Quit
>
Quote:
Quote:

> > > ===================================================================
>
Quote:
Quote:

> > > Please help urgent request.
> > > simple explanation
>
Quote:
Quote:

> > > many thanks
>
Quote:

> > Using the WSH registry items, the only way to test for the presence/
> > absence of a key is to test for the success or failure of the RegRead
> > method, something like this ...
>
Quote:

> > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS" _
> > * * * * * * * * *& "\RMS63\uninstallRMS6.bat"
> > sKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" _
> > * * *& "\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\"
> > if CStr(CheckRegKey(sKey)) then
> > * set WshShell = CreateObject("WScript.Shell")
> > * WSHShell.Run strUninstallRMS6, 1 , FALSE
> > end if
>
Quote:

> > Function CheckRegKey(sKey)
> > * On Error Resume next
> > * * with CreateObject("WScript.Shell")
> > * * * .RegRead sKey
> > * * end with
> > * * CheckRegKey = (Err.Number = 0)
> > * On Error Goto 0
> > end function
>
Quote:

> > Tom Lavedas
> > ===========http://members.cox.net/tglbatch/wsh/-Hide quoted text -
>
Quote:

> > - Show quoted text -
>
> Hi
>
> Thankyou very much for your answers. Unfortunately when i run the
> script as a .vbs nothing happens. the key is not removed.
> i have confirmed the key "{264600DE-0879-4231-9F93-9CE3D503DFC1}"
> diffenatelty exist.
>
> thankyou very much- Hide quoted text -
>
> - Show quoted text -

the script should work.
if the registry key exist. then batch job executes located on the
server.

the batch file on the server

=========================================================================
"\\lbnfilr002\Packages\PkgsQ-T\RMS\RMS63\uninstallRMS6.bat"

@ECHO OFF
MsiExec.exe /uninstall {264600DE-0879-4231-9F93-9CE3D503DFC1} /quiet
EXIT

==========================================================================

Ive tested the below and it definately works

set WshShell = WScript.CreateObject("WScript.Shell")

strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
\RMS63\uninstallRMS6.bat"

WSHShell.Run strUninstallRMS6, 1 , FALSE

WScript.Quit

===========================================================================

Thanks
My System SpecsSystem Spec
Old 09-24-2008   #5 (permalink)
Tom Lavedas


 
 

Re: vbscript registry exist then......

On Sep 24, 5:46*am, deen <an...@xxxxxx> wrote:
Quote:

> On 24 Sep, 09:49, deen <an...@xxxxxx> wrote:
>
>
>
Quote:

> > On 23 Sep, 17:38, Tom Lavedas <tglba...@xxxxxx> wrote:
>
Quote:
Quote:

> > > On Sep 23, 12:05*pm, deen <an...@xxxxxx> wrote:
>
Quote:
Quote:

> > > > Please help urgent request
>
Quote:
Quote:

> > > > PLease help with VBScript
> > > > ive tried 2 ways they both dont wort, can you tell me where i;m going
> > > > wrong rahter than email me script i dont understand.
>
Quote:
Quote:

> > > > thanks
>
Quote:
Quote:

> > > > set WshShell = WScript.CreateObject("WScript.Shell")
>
Quote:
Quote:

> > > > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> > > > \RMS63\uninstallRMS6.bat"
>
Quote:
Quote:

> > > > Function RegistryItemExists (RegistryItem)
>
Quote:
Quote:

> > > > If RegistryItemExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
> > > > \CurrentVersion\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\")
> > > > then
>
Quote:
Quote:

> > > > WSHShell.Run strUninstallRMS6, 1 , FALSE
>
Quote:
Quote:

> > > > end if
>
Quote:
Quote:

> > > > WScript.sleep 30000
>
Quote:
Quote:

> > > > WScript.Quit
>
Quote:
Quote:

> > > > =================================================================
>
Quote:
Quote:

> > > > set WshShell = WScript.CreateObject("WScript.Shell")
>
Quote:
Quote:

> > > > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> > > > \RMS63\uninstallRMS6.bat"
>
Quote:
Quote:

> > > > If WshShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
> > > > \Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\") = true Then
> > > > WSHShell.Run strUninstallRMS6, 1 , FALSE
>
Quote:
Quote:

> > > > End If
> > > > WScript.sleep 30000
>
Quote:
Quote:

> > > > WScript.Quit
>
Quote:
Quote:

> > > > ===================================================================
>
Quote:
Quote:

> > > > Please help urgent request.
> > > > simple explanation
>
Quote:
Quote:

> > > > many thanks
>
Quote:
Quote:

> > > Using the WSH registry items, the only way to test for the presence/
> > > absence of a key is to test for the success or failure of the RegRead
> > > method, something like this ...
>
Quote:
Quote:

> > > strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS" _
> > > * * * * * * * * *& "\RMS63\uninstallRMS6.bat"
> > > sKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" _
> > > * * *& "\Uninstall\{264600DE-0879-4231-9F93-9CE3D503DFC1}\"
> > > if CStr(CheckRegKey(sKey)) then
> > > * set WshShell = CreateObject("WScript.Shell")
> > > * WSHShell.Run strUninstallRMS6, 1 , FALSE
> > > end if
>
Quote:
Quote:

> > > Function CheckRegKey(sKey)
> > > * On Error Resume next
> > > * * with CreateObject("WScript.Shell")
> > > * * * .RegRead sKey
> > > * * end with
> > > * * CheckRegKey = (Err.Number = 0)
> > > * On Error Goto 0
> > > end function
>
Quote:
Quote:

> > > Tom Lavedas
> > > ===========http://members.cox.net/tglbatch/wsh/-Hidequoted text -
>
Quote:
Quote:

> > > - Show quoted text -
>
Quote:

> > Hi
>
Quote:

> > Thankyou very much for your answers. Unfortunately when i run the
> > script as a .vbs nothing happens. the key is not removed.
> > i have confirmed the key "{264600DE-0879-4231-9F93-9CE3D503DFC1}"
> > diffenatelty exist.
>
Quote:

> > thankyou very much- Hide quoted text -
>
Quote:

> > - Show quoted text -
>
> the script should work.
> if the registry key exist. then batch job executes located on the
> server.
>
> the batch file on the server
>
> =========================================================================
> "\\lbnfilr002\Packages\PkgsQ-T\RMS\RMS63\uninstallRMS6.bat"
>
> @ECHO OFF
> MsiExec.exe /uninstall {264600DE-0879-4231-9F93-9CE3D503DFC1} /quiet
> EXIT
>
> ==========================================================================
>
> Ive tested the below and it definately works
>
> set WshShell = WScript.CreateObject("WScript.Shell")
>
> strUninstallRMS6 = "\\lbnfilr002\Packages\PkgsQ-T\RMS
> \RMS63\uninstallRMS6.bat"
>
> WSHShell.Run strUninstallRMS6, 1 , FALSE
>
> WScript.Quit
>
> ===========================================================================
>
> Thanks
Sorry, I left a bit of test code in the script I posted. The line
that reads ...

if CStr(CheckRegKey(sKey)) then

should be ...

if CheckRegKey(sKey) then

The function CheckRegKey returns a boolean result suitable for testing
with an IF statement, but in my testing I had converted that result to
a string for ECHOing in a message box. I cut and pasted from the test
script and forgot to remov the conversion to a string.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
VBScript to traverse all Registry keys VB Script
VBScript to traverse all Registry keys VB Script
merge *.reg into registry by vbscript? VB Script
How to rename a registry key using vbscript? VB Script
vbscript if reg exist ..... VB Script


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46