Confirm DST2007 Regkey for a specific computer interactively - RCrumbaker Web Remote Tools 3.21

The boss asked for a button on the Web Remote Tools page so that local techs could run a quick "is it patched" during the next few weeks to quickly eliminate any questions about problems that *may* be reported and trying to associate whatever that problem may be with an unpatched computer.  I'll probably yank this button off the page in April; but if anyone else is interested... 

Edit MachRest.asp, and add a button by your other buttons (about line 80-ish):
<INPUT id="Button730" style='WIDTH: 180px' type='button' value='Confirm DST Fix' name='Btnl730'>

Then copy/paste the below (the Sub) probably near the bottom, just before the </script>, after all of the other SUB/end Sub routines.  In the attached sub routine, change the "YourSMSServerNameHere" to match your SMS server name. 

Sub Btnl730_OnClick
On Error resume next
 Set sho = CreateObject("WScript.Shell")
 CompName = trim(document.frmMain.txtValue.value)
 if len(trim(CompName)) = 0 Then
              MsgBox "Computer Name or IP required",,"Confirm DST Fix"
            Else
             Set WShell = CreateObject("WScript.Shell")
  Set objPing = GetObject("winmgmts://" & "YourSMSServerNameHere" & "/root/default:PingPoller")
  objPing.Ping Compname, "100", "1", PingResult
  if PingResult <> 0 then
   msgbox "Machine did not respond to ping.",,"Confirm DST Fix"
  Else

 dim strRegValue(100)
 dim strRegValue2(100)
 Const hRegTree = &H80000002
 Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
   CompName & "\root\default:StdRegProv")
   strRegKey = "SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
    strRegDataType = "BINARY"
    strRegValueName = "DaylightStart"
      intResult = objReg.GetBinaryValue(hRegTree, strRegKey, strRegValueName, strRegValue)
    strRegValueName2 = "StandardStart"
      intResult2 = objReg.GetBinaryValue(hRegTree, strRegKey, strRegValueName2, strRegValue2)

 If strRegValue(2) <> 3 Or strRegValue(4) <> 2 Or strRegValue(6) <> 2 Then
    i=1
 end if
 If strRegValue2(2) <> 11 Or strRegValue2(4) <> 1 Or strRegValue2(6) <> 2 Then
    i=i+1
 end if
 select case i
   case 0
     strComment = "Success Indicated"
   case 1
     strComment = "Inconsistent Results"
   case 2
     strComment = "Failure: Values do not match expected"
   case else
     strComment = "Inconsistent Results"
 end Select
MsgBox CompName & ": " & strcomment,vbOKOnly,"Confirm DST Fix"
            end if
end If 
 
End Sub

Published Friday, March 09, 2007 12:26 PM by skissinger

Comments

No Comments