Remote reboot of servers using asp/js

  • robwdav
  • Born
  • Born
  • robwdav
  • Posts: 2

Post 3+ Months Ago

Hello,

New member here, but in need of ideas. I'm currently working on a remote reboot site for my company. However, I want to implement a check box which a user mut check before completing the reboot. I have the basic function of the site working(it will reboot the machines) but requires no verification. The code is below, anyone with ideas...please lend them.

Thanks,
Code: [ Select ]
<%@ Language=VBScript %>
<HTML>
    <HEAD>
        <title></title>
        <script language="vbscript">
     function exec(cmds)
     cmds = cmds & servers.value
     alert cmds
     set objShell = CreateObject("WScript.Shell")
     objShell.Run cmds
     end function
        </script>
        <script id="clientEventHandlersJS" language="javascript">
<!--

function Radio1_onclick() {

Form.Submit1.Reboot.value=Reboot;
}

//-->
        </script>
    </HEAD>
    <body>
        <P>
        <SELECT id="Select1" name="Servers">
        <OPTION        <OPTION value=""></OPTION>
        </SELECT></P>
        <P>&nbsp;<INPUT id="Radio1" type="radio" value="Radio1" name="RadioGroup" onclick="Return Radio1_onclick()">&nbsp;Yes&nbsp;</P>
        <P></P>
        <input type="submit" value="Reboot" onclick="exec('shutdown -r -t 0 -f -m ')" ID="Submit1"
            NAME="Reboot"><br>
        <P></P>
    </body>
  1. <%@ Language=VBScript %>
  2. <HTML>
  3.     <HEAD>
  4.         <title></title>
  5.         <script language="vbscript">
  6.      function exec(cmds)
  7.      cmds = cmds & servers.value
  8.      alert cmds
  9.      set objShell = CreateObject("WScript.Shell")
  10.      objShell.Run cmds
  11.      end function
  12.         </script>
  13.         <script id="clientEventHandlersJS" language="javascript">
  14. <!--
  15. function Radio1_onclick() {
  16. Form.Submit1.Reboot.value=Reboot;
  17. }
  18. //-->
  19.         </script>
  20.     </HEAD>
  21.     <body>
  22.         <P>
  23.         <SELECT id="Select1" name="Servers">
  24.         <OPTION        <OPTION value=""></OPTION>
  25.         </SELECT></P>
  26.         <P>&nbsp;<INPUT id="Radio1" type="radio" value="Radio1" name="RadioGroup" onclick="Return Radio1_onclick()">&nbsp;Yes&nbsp;</P>
  27.         <P></P>
  28.         <input type="submit" value="Reboot" onclick="exec('shutdown -r -t 0 -f -m ')" ID="Submit1"
  29.             NAME="Reboot"><br>
  30.         <P></P>
  31.     </body>

I've omitted the names of the servers....not relevant really.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Welcome to Ozzu robwdav :)
Please remember to use
Code: [ Select ]

or
PHP Code: [ Select ]
 
tags when posting code, I've fixed your original post.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

As for your problem, Would having a "yes/no" confirmation box work in place of a checkbox for you ? If so you can do somthing like this,
Code: [ Select ]
inside javascript tags...
function confirmReboot(){
   if(confirm("Are you sure you want to reboot this server ?")){
     exec('shutdown -r -t 0 -f -m ');
   }
}
.......
in form.....
<input type="submit" value="Reboot" onclick="confirmReboot();" ID="Submit1"
     NAME="Reboot">
  1. inside javascript tags...
  2. function confirmReboot(){
  3.    if(confirm("Are you sure you want to reboot this server ?")){
  4.      exec('shutdown -r -t 0 -f -m ');
  5.    }
  6. }
  7. .......
  8. in form.....
  9. <input type="submit" value="Reboot" onclick="confirmReboot();" ID="Submit1"
  10.      NAME="Reboot">
  • robwdav
  • Born
  • Born
  • robwdav
  • Posts: 2

Post 3+ Months Ago

That's awesome Joebert....Thanks!

Just a few changes...all is well now.

Thanks again
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

No problem :)
Thanks to you as well, I'm going to play with your idea on my home network, So instead of using winvnc to shut down the filecabnet I can just click a shortcut on my desktop :D

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 66 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.