VB script question

Associate
Joined
28 Dec 2006
Posts
11
Hello

Is anyone any good at VB scripting? I'd like to write a script which comes up with a box where you would enter a computer name then the script would apply a reg file (which I've got) to this computer.

Any ideas?

Cheers

Here's the reg file:
Code:
Windows Registry Editor Version 5.00

[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService\Parameters]
"Certificate"=-
 
Last edited:
Hi,

This is the script now although when I click on the Cancel button, it brings up an error with line 10 (the line suggested above).

Googling the error e.g. http://www.computerperformance.co.uk/Logon/code/code_80041021.htm

suggests line 10 is right.

Can anyone help?

Thanks

Code:
'Dave and Mark's Remote RemoteAssistance Regfix
'Version 1.1 (01 February 2007)
'


' Define variables
	Const HKEY_LOCAL_MACHINE = &H80000002

	strComputer = InputBox("Enter Computer Name:", "DT/MB Remote RemoteAssistance Fix")
	Set objRegistry = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

	strKeyPathPara = "SYSTEM\CurrentControlSet\Services\TermService\Parameters"
	strValueNameCert = "Certificate"
	strKeyPathMSs = "SOFTWARE\Microsoft\MSLicensing\Store"
	strKeyPathMSh = "SOFTWARE\Microsoft\MSLicensing\HardwareID"
	strKeyPathMS = "SOFTWARE\Microsoft\MSLicensing"


' Delete value
	Return1 = objRegistry.DeleteValue (HKEY_LOCAL_MACHINE,strKeyPathPara,strValueNameCert)


' Delete Key
	Return2 = objRegistry.DeleteKey (HKEY_LOCAL_MACHINE,strKeyPathMSs)
	Return3 = objRegistry.DeleteKey (HKEY_LOCAL_MACHINE,strKeyPathMSh)
	Return4 = objRegistry.DeleteKey (HKEY_LOCAL_MACHINE,strKeyPathMS)
	If (Return1 = 0) And (Return4 = 0) And (Err.Number = 0) Then
		WScript.Echo "Success! HKEY_LOCAL_MACHINE\" & strKeyPathMS & " has been deleted"  & VBNewLine & "Success! HKEY_LOCAL_MACHINE\" & strKeyPathPara & "\" & strValueNameCert & " has been deleted"
	Else
		WScript.Echo "Failed! HKEY_LOCAL_MACHINE\" & strKeyPathMS & " has not been deleted" & VBNewLine & "Failed! HKEY_LOCAL_MACHINE\" & strKeyPathPara & "\" & strValueNameCert & " has not been deleted"
	End If
 
do While (strComputer = vbNullString)
Exit Do
loop

Changing it to the above still doesn't do what I want it to do. I still get the error with the line outlined above...
 
That works all fine except... If someone clicks cancel I don't want the message to pop up, I want the program to exit, which I can't work out how to do...
 
Back
Top Bottom