Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript ActiveX Help with PING/Bat/Exec/RDP/Telnet

Status
Not open for further replies.

LantanaCom

IS-IT--Management
Nov 4, 2009
8
US
Alright, First I am a Newbie at C++ and Furthurmore Java, I have basic Knowlege of C++ and HTML only.

I am using ASP, Pages Currently.

I am creating an internal Web Page for the company I work for, The "Page" I am now working on now, is my "IT" Page, which I have a list of Servers, Switches, Routers and Other.

For Each Switch/Router/Server I want to be able to execute ping command, This can run on server side or client side (Using all Windows enviroment and is only being used for our company internaly). I would love for this to run within the webpage but I have read where this isnt possible.

My Template,(I would like for each table in its own .htm)

Table1.htm
col1,col2,col3
Server1,pingCheckbox,runRDP
Server2,pingCheckbox,runRDP
Server3,pingCheckbox,runDRP
,pingSubmit,
,pingAllSubmit,

Table2.htm
col1,col2,col3,col4
Switch1,pingCheckbox,runTelnet,hrefHTTP
Switch2,pingCheckbox,runTelnet,hrefHTTP
Switch3,pingCheckbox,runTelnet,hrefHTTP
,pingSubmit,,
,pingAllSubmit,,

Table3.htm
col1,col2,col3,col4
Router1,pingCheckbox,runTelnet,hrefHTTP
Router2,pingCheckbox,runTelnet,hrefHTTP
Router3,pingCheckbox,runTelnet,hrefHTTP
,pingSubmit,,
,pingAllSubmit,,

//Ping Everything that is checked in each table
PingMaster.htm (Or Main ASP Page?)
Table1
Table2
Table3
pingMasterSubmit

So above is what I would like, I am open to ideas or sagestions, I have it in a table format beacuse for Routers/Switch/Other I have other options I would like to perform like, HTTP or Telnet. Servers I want to be able to RDP to.

Currently I have links setup to a read-only FTP site executing "Bat". When ever I execute the link everything works great other than I have to hit run everytime and then it downloads it to temp folder on PC. I am trying to keep most of it WebBassed to keep from uneeded files on PC building up.

So what I need to know is,
How I can make a function or Bat execute without haveing to hit "run" everytime.

For my runTelnet and runRDP I want these to be per device functions only using "buttons".

For my pingCheckbox I want these to be a "checkbox" for each device, but I only want it to execute once you hit ,pingSubmit, for the given table or pingMasterSubmit

My goal here is to open Multiple Command Prompt Windows while doing a ping for each device in their own Window. So "Check Boxes" for the following (Router1,Switch1,Switch2,Server1) then hit pingMasterSubmit and it will open 4 CMD Windows and ping those checked devices, or hit pingSubmit for each table and it will on open windows and ping the devices checked for that table.

Here is example of my batch file that I use to ping multiple at one time in different Windows.

start cmd /k PING -t 172.16.101.225
start cmd /k PING -t 172.16.101.227
start cmd /k PING -t 172.16.101.228

Not any way do I think I know what I am doing so please dont hesatate to correct anything I am trying to do or put me straight :) I am trying to make everything as clear as possible. With any given information above, I should be able to figure out most of everyhting else on my own, I am just having a hard time for a checkbox to execute.

Thanks,
Jarret
 
How I can make a function or Bat execute without haveing to hit "run" everytime.

This I can help you with: use a scheduled task


Your posting, from what i can tell has NOTHING to do with Javascript.

--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
I am not trying to creat a schedualed task.

I am trying to create a web page that I can execute multiple batch files for me, depending on what "check boxes" I select. I do not want them to execute opon "check" either. I want them to execute after I 'check' which ones should run and then hit a "submit" button to query which ones are 'checked' and then run thier assoiciated batch file. In return opening one to many windows.

Like I said it doesnt have to be in the form of a batch file either, As long as it gets the task done is all I am looking for.

The point of this page is not to run daily/schedualed task, its for ease of managment, checking to see if a servers LIVE, or if you checking cables and need to figure out what is plugged in where, you can run them all at one time. Remoteing to a server or switch using using RDP and Telnet.

My goal is to get most of what I do on a single organized page and be able to navigate with a click of a button.
 
Just for clarification, Java is a completely different language and unrelated to Javascript.

With that said, yes you can use ActiveX to execute local programs, though it will only work under IE. And not any other browser. However seeing as your are doing this for yourself, it should not be a problem.

This outlines the basic ActiveX script to run an executable:
Though you may need to set your IE to trust the page that will run the ActiveX component.

However doing this web based may not be the best option as you see, web pages are not designed to run local applications.

You may want to look at:
forum194
or
forum708


Alternatively, you could install PHP or some other serverside language on your PC along with a local webserver, and have PHP execute all the commands you need. Since the server would be the local machine it would run the bat's without to much hassle. And you can have it return the output to the script to show it in the webpage.

forum434



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
How does PHP intergrate with IIS6? Easy or totally different area?

I am open to all sagestions, I know that HTML is not designed to do this but have read of people it. I am not just limiting it from one though, It will actaully be hosted from a Internal Server runnning IIS6, So I can access it from multiple PC's/Servers.
 
PHP integrates just fine onto IIS6. It even has an installer you can run and have it configure IIS for you.
If you do go the PHP route, thee obviously all your BAT files will need to be located in the server that's hosting the PHP interpreter.






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I downloaded PHP installed for Windows, I plan on messing with it tommarow.

Do you have an Examples of a PHP executing a BAT from IIS server?

By the way thanks for your help.

Before I get ahead of myself, is this PHP page going to be able to be controlled by HTML Form/Check Box and Submit Button?
 
Do you have an Examples of a PHP executing a BAT from IIS server?

You'd need to use server-side scripting (ASP for IIS) to do this.

If you intend on using VBScript to write the code, you'd need to ask in the appropriate forum. If you intend on using JScript to write the code, here is the best place to ask... the only reason I mention this is that most people use VBScript (although why, I can't fathom!).

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
You'd need to use server-side scripting (ASP for IIS) to do this.
Not necessarily, which is why I suggested PHP. PHP is perfectly capable of executing BAT files.

Before I get ahead of myself, is this PHP page going to be able to be controlled by HTML Form/Check Box and Submit Button?

Yup. No problem at that. Just create your regular HTML form, and submit it to your PHP processing script.

At its simplest: This script will run your batch file and print back whatever output it produces:

Code:
$res=exec("ping 192.168.0.1", $output, $result);
echo "<pre>";
print_r($output);
echo "</pre>";

Of course this has now evolved into a PHP deal so I suggest you move over to the PHP forum if you want to continue this.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Sorry if I was unclear - I wasn't suggesting ASP on IIS was the only way, only that if he was using IIS, ASP was the obvious choice.

Certainly, PHP is more than capable as well.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top