Video Screencast Help
Symantec Appoints Michael A. Brown CEO. Learn more.

Registry key

Created: 11 Nov 2010 • Updated: 11 Nov 2010 | 3 comments
This issue has been solved. See solution.

Hi

Is there a way using WiseScript to check if registry key exists, not registry value.

Thanks in advance.

Discussion Filed Under:

Comments 3 CommentsJump to latest comment

KOM Networks's picture

Use vbscript instead:

 

If KeyExist("HKCR\.bmp\PersistentHandler\") Then
Session.Property("KEYEXIST") = "what ever value you want"
End If
 
Function KeyExist(REGKEY)
Dim WSHShell, sRegKey
KeyExist = False
 
Set WSHShell = CreateObject("WScript.Shell")
Err.Clear
On Error Resume Next
sRegKey = WSHShell.RegRead(REGKEY)
 
If Err.Number = 0 Then
KeyExist = True
End If
End Function 
SOLUTION
EdT's picture

The Wisescript command is "Get Registry Key Value

Consequently you cannot use Wisescript to directly check if a key exists. 

The solution above is probably the simplest to implement.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.