Executing a Command using asp

Discussion in 'ASP General' started by Sh0t2bts, Aug 15, 2006.

  1. Sh0t2bts

    Sh0t2bts Guest

    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
    Sh0t2bts, Aug 15, 2006
    #1
    1. Advertising

  2. Sh0t2bts

    Frankyt Guest

    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

    "Sh0t2bts" wrote:

    > 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
    >
    >
    Frankyt, Oct 21, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. simon
    Replies:
    0
    Views:
    625
    simon
    May 24, 2005
  2. Carlos

    executing remote command

    Carlos, Jul 27, 2004, in forum: Java
    Replies:
    4
    Views:
    582
    zoopy
    Jul 28, 2004
  3. Arun
    Replies:
    4
    Views:
    317
    anonymous
    Jan 3, 2005
  4. Peter Otten
    Replies:
    3
    Views:
    721
    Nobody
    Feb 15, 2010
  5. Brian

    executing a db command in asp

    Brian, Jan 20, 2004, in forum: ASP General
    Replies:
    3
    Views:
    314
    Brynn
    Jan 20, 2004
Loading...

Share This Page