Googling I found this (http://www.rgagnon.com/javadetails/java-0014.html) so I'd suppose that if you adjust the code below:
========
import java.io.*;
public class CmdExec {
public static void main(String argv[]) {
try {
String line;
Process p = Runtime.getRuntime().exec
(System.getenv("windir") +"\system32"+"tree.com /A");
BufferedReader input =
new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
}
catch (Exception err) {
err.printStackTrace();
}
}
}
========
By changing:
Process p = Runtime.getRuntime().exec
(System.getenv("windir") +"\system32"+"tree.com /A");
in
Process p = Runtime.getRuntime().exec
(System.getenv("windir") +"\system32"+"wscript.exe c:yourscript.vbs hosttocheck");
coule lead you to the solution.
In the vbscript I suggest you to use command-line arguments in order to be able to pass the remote host's name/ip
E.g.
' VbScript code
Dim HostToCheck
Set objArgs = WScript.Arguments
If objArgs.Count > 0 Then
HostToCheck = objArgs(0)
End If
....
I hope this helps
Last Wiki Answer Submitted: May 14, 2008 8:26 am by alessandro.panzetta9,695 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.