SUB Btnl729_onclick const HKEY_LOCAL_MACHINE = &H80000002 CompName = trim(document.frmMain.txtValue.value) if CompName = "" then msgbox "Computer Name or IP required",,"SMS remote permissions Toggle" 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.",,"Toggle SMS Permissions" else err.clear Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ compname & "\root\default:StdRegProv") if err.number <> 0 then msgbox "Unable to connect to WMI on " & CompName & vbcr &_ "Error: " & err.description,,"SMS Remote Toggle" else strKeyPath = "SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control" strValueName = "Permission Required" i=0 oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue If dwValue = 1 Then i=0 strNote = "The computer used to require a prompt before allowing an SMS " & _ vbCRLF & "Remote Control request. The computer has now been temporarily " & _ vbCRLF & "set to allow Remote Control via SMS Remote Control tool without " & _ vbCRLF & "a prompt asking for permission. In a few minutes, the computer " & _ vbCRLF & "will on it's own re-evaluate what the settings are supposed to " & _ vbCRLF & "be, and will be reset to again require permission. " & _ vbCRLF & _ vbCRLF & "However, it is strongly recommended for security reasons to re-run" & _ vbCRLF & "this utility to turn Remote control permissions back on as soon as" & _ vbCRLF & "you are done." Else i=1 strNote = "The computer used to allow SMS Remote control without a prompt " & _ vbCRLF & "asking for permission. This has been reset to require permission." End If 'on getting registry value dwValueNew = i oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValueNew msgbox strNote,,"SMS Remote Toggle" end if 'for WMI Connection end if 'for Ping end if 'for computer name empty End Sub