Executing a Command using asp

S

Sh0t2bts

Hi,

I am using the below command to restart a service on one of my web
boxes, this runs fine from the command prompt and also through a *.bat
file.

"\\Server1\Applist$\BOBJCentralMS\psservice.exe" \\Server2 -u
eutee-ww02p\Username -p password restart BOBJCentralMS



I found this asp code in this forum but can not get it to work with my
command
<%
Dim oShell, sCommand
sCommand = "MyCommand"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing
%>

I replace "MYCommand" with the command i wish to execute but the page
just hangs with the blue status bar halfway complete at the bottom,
when checking the services on the box it is not restarted.

Any Ideas

Many Thanks

Mark
 
F

Frankyt

this may be a dumb question , but do your have sysinternals "psservice.exe"
available on a share on server1 called applist$\BobJCentralMS\ ?

if thats not it
you should look into using psexec to execute the sc start command (sc is
service controler). you can find all the info you need to start a service
with it via "sc /?"

also in windows forms there is a shell call called "shell(cmd as string,
appstyle as enum, wait as boolean, timout as integer )". I use it all the
time, but I don't know if it;s in ASP.

good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top