Remove dependency on smssend.vbs - RCrumbaker Web Remote Tools v3.21

To make the page more portable, the "Refreshbtn_onclick" subroutine was replaced in our environment.  Replacing this section will remove the dependency on having "smssend.vbs" in the %windir% folder.

Edit Machrest.asp (make a backup first), and find Sub Refreshbtn_onClick.  Replace everything between Sub Refreshbtn_onClick and End Sub with this:

 dim CompName,wShell,objPing,smsclient
 CompName = trim(document.frmMain.txtValue.value)
 if len(trim(CompName)) = 0 then
  msgbox "Please type a Machine Name.",,"SMS Machine Policy"
 else
  Set WShell = CreateObject("WScript.Shell")
  Set objPing = GetObject("winmgmts://" & ServerName & "/root/default:PingPoller")
  objPing.Ping CompName, "100", "1", PingResult
  if PingResult <> 0 then
   msgbox "Machine did not respond to ping.",,"SMS Machine Policy"
   wscript.quit
  else
    err.clear
    Set smsClient = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
    CompName & "\root\ccm:SMS_Client")
     if err.number <> 0 then
     msgbox "Unable to access " & CompName & vbcr &_
                   "Error: " & err.description,,"SMS Machine Policy"
           wscript.quit
   end if
    smsClient.RequestMachinePolicy
    smsclient.EvaluateMachinePolicy
    msgbox "Executed Remote SMS Machine Policy Request.",,"SMS Machine Policy"
  end if
 end if

Alternative Edit (something the ping part doesn't work right for me):

dim CompName,wShell,objPing,smsclient
 CompName = trim(document.frmMain.txtValue.value)
 if len(trim(CompName)) = 0 then
  msgbox "Please type a Machine Name.",,"SMS Machine Policy"
 else
  Set WShell = CreateObject("WScript.Shell")
    err.clear
    Set smsClient = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
    CompName & "\root\ccm:SMS_Client")
     if err.number <> 0 then
     msgbox "Unable to access " & CompName & vbcr &_
                   "Error: " & err.description,,"SMS Machine Policy"
    else
    smsClient.RequestMachinePolicy
    smsclient.EvaluateMachinePolicy
    msgbox "Attempted to execute Remote SMS Machine Policy Request.",,"SMS Machine Policy"
  end if
 end if

Published Wednesday, April 04, 2007 7:13 PM by skissinger

Comments

# re: Remove dependency on smssend.vbs - RCrumbaker Web Remote Tools v3.21

Sherry

have you seen the error on line 363 Char 3, Error could not completethe operation due to error 80014021

Friday, November 30, 2007 4:41 PM by hcortez463

# re: Remove dependency on smssend.vbs - RCrumbaker Web Remote Tools v3.21

I can't say that I have seen that particular error.  But when I'm customizing, I often mess up several times until I get it right.  And sometimes the change(s) I've made don't correlate to where the error message indicates.  i.e., line 363 mentioned might not actually be line 363 in machrest.asp

Friday, November 30, 2007 10:08 PM by skissinger

# re: Remove dependency on smssend.vbs - RCrumbaker Web Remote Tools v3.21

:)  first of all i want to let you know that you are greatly appriciated.. :)  I added the "on error resume next" at the top of this scirpt and everything is working..

Wednesday, December 05, 2007 9:52 AM by hcortez463

# re: Remove dependency on smssend.vbs - RCrumbaker Web Remote Tools v3.21

agg.. sorry spoke to soon.. still not working.. will look into it more

Wednesday, December 05, 2007 10:47 AM by hcortez463