Hi All,
I am trying to create a script which will allow me to remotely fix Active Desktop Recovery issues via the registry. All of the security shares etc work correctly and I have tried using both the psexec tool and the in built remote registry functionality.
My code appears to be correct, however when I attempt to update the registry key it does not change.
I am launching a HTA file which then launches another file to obtain the SID's on the remote PC, I manually copy these details into a text input box on the original HTA and click a button to execute the registry change, I am not receiving any errors but the key still does not seem to be updating.
My code is modified from a script I use to edit the netcache registry key. Any ideas for why this does not seem to be working?
The code for my first HTA is
----------------------------------------------
<html>
<head>
<title>Active Desktop Recovery</title>
<HTA:APPLICATION
APPLICATIONNAME="Active Desktop Recovery"
ID="MyHTMLapplication"
VERSION="1.0"/>
</head>
<script language="VBScript">
Function contactPing
On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
Err.Clear
strPingResults = ""
contactPing = False
Set oStrResult = objShell.Exec("ping -a -n 1 -w 50 " & Trim(txtComputerName.value))
Do While Not oStrResult.StdOut.AtEndOfStream
strResult = oStrResult.StdOut.ReadLine()
If InStr(strResult,"Reply") = 1 Then
strPingResults = strPingResults & strResult
contactPing = True
End If
Loop
End Function
Sub btnFindUser_OnClick
If contactPing Then
Set objShell = CreateObject("WScript.Shell")
objShell.Run("""c:\windows\system32\mshta.exe"" ""C:\Program Files\Admin Tools\Log.hta""")
End If
End Sub
Sub btnClearCSC_OnClick
If contactPing Then
Set objShell = CreateObject("Wscript.Shell")
Err.Clear
strResult = objShell.Run("psexec -i -d \\" & trim(txtComputerName.value) & " reg add ""HKU\" & (txtUserID.value) & "\Software\Microsoft\Internet Explorer\Desktop\SafeMode\Components\"" /v DeskHtmlVersion /t reg_dword /d 0x00000001(0)",3,false)
If strResult = 0 Then
If Err.Number <> 0 Then
MsgBox "ERROR starting ClearCSC on " & Trim(txtComputerName.value)
End if
Else
MsgBox "ERROR starting ClearCSC on " & Trim(txtComputerName.value)
End If
Else
MsgBox "ERROR starting ClearCSC on " & Trim(txtComputerName.value)
End If
End Sub
</script>
<body bgcolor="white">
<!--Add your controls here-->
<td><input name="txtComputerName" title="Enter a the computer you wish to query" TYPE="TEXT" SIZE="15"></td>
<td><input name="txtUserID" title="Enter available User ID" TYPE="TEXT" SIZE="50"></td>
<INPUT NAME="btnClearCSC" title="Clear CSC" TYPE="BUTTON" VALUE="Clear CSC">
<INPUT NAME="btnFindUser" title="Clear CSC" TYPE="BUTTON" VALUE="Find User">
<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>
------------------------------------------------------------------------------
I am trying to create a script which will allow me to remotely fix Active Desktop Recovery issues via the registry. All of the security shares etc work correctly and I have tried using both the psexec tool and the in built remote registry functionality.
My code appears to be correct, however when I attempt to update the registry key it does not change.
I am launching a HTA file which then launches another file to obtain the SID's on the remote PC, I manually copy these details into a text input box on the original HTA and click a button to execute the registry change, I am not receiving any errors but the key still does not seem to be updating.
My code is modified from a script I use to edit the netcache registry key. Any ideas for why this does not seem to be working?
The code for my first HTA is
----------------------------------------------
<html>
<head>
<title>Active Desktop Recovery</title>
<HTA:APPLICATION
APPLICATIONNAME="Active Desktop Recovery"
ID="MyHTMLapplication"
VERSION="1.0"/>
</head>
<script language="VBScript">
Function contactPing
On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
Err.Clear
strPingResults = ""
contactPing = False
Set oStrResult = objShell.Exec("ping -a -n 1 -w 50 " & Trim(txtComputerName.value))
Do While Not oStrResult.StdOut.AtEndOfStream
strResult = oStrResult.StdOut.ReadLine()
If InStr(strResult,"Reply") = 1 Then
strPingResults = strPingResults & strResult
contactPing = True
End If
Loop
End Function
Sub btnFindUser_OnClick
If contactPing Then
Set objShell = CreateObject("WScript.Shell")
objShell.Run("""c:\windows\system32\mshta.exe"" ""C:\Program Files\Admin Tools\Log.hta""")
End If
End Sub
Sub btnClearCSC_OnClick
If contactPing Then
Set objShell = CreateObject("Wscript.Shell")
Err.Clear
strResult = objShell.Run("psexec -i -d \\" & trim(txtComputerName.value) & " reg add ""HKU\" & (txtUserID.value) & "\Software\Microsoft\Internet Explorer\Desktop\SafeMode\Components\"" /v DeskHtmlVersion /t reg_dword /d 0x00000001(0)",3,false)
If strResult = 0 Then
If Err.Number <> 0 Then
MsgBox "ERROR starting ClearCSC on " & Trim(txtComputerName.value)
End if
Else
MsgBox "ERROR starting ClearCSC on " & Trim(txtComputerName.value)
End If
Else
MsgBox "ERROR starting ClearCSC on " & Trim(txtComputerName.value)
End If
End Sub
</script>
<body bgcolor="white">
<!--Add your controls here-->
<td><input name="txtComputerName" title="Enter a the computer you wish to query" TYPE="TEXT" SIZE="15"></td>
<td><input name="txtUserID" title="Enter available User ID" TYPE="TEXT" SIZE="50"></td>
<INPUT NAME="btnClearCSC" title="Clear CSC" TYPE="BUTTON" VALUE="Clear CSC">
<INPUT NAME="btnFindUser" title="Clear CSC" TYPE="BUTTON" VALUE="Find User">
<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>
------------------------------------------------------------------------------