You trap the error.

 

                On error resume next

                Set val = wshshell.regread ...

                If err then

                                Do something

                Else

                                Something else

                End If

                On error goto 0

 

Regards,

 

Michael B. Smith, MCITP:SA,EMA/MCSE/Exchange MVP

My blog: http://TheEssentialExchange.com/blogs/michael

Link with me at: http://www.linkedin.com/in/theessentialexchange

 

From: Joseph L. Casale [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 17, 2008 1:43 PM
To: NT System Admin Issues
Subject: VBScript and registry

 

What's the right way to check for a value in the registry, and if its not
there then I can do what I need.

I have a custom key we use, HKLM\My Custom Key\... but if I attempt a
WshShell.RegRead "HKLM\My Custom Key\" and its not yet created I get an
error? So what's the equivalent "if exist" method?

 

Thanks!
jlc

 

 

 

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to