Solved

Stopping dependant service via script server 2008

Posted on 2011-09-19
1
346 Views
Last Modified: 2012-05-12
Hi,

I need to restart a Backup exec remote agent service on a Server 2008 every day and would like to use a script for this. Unfortunately there is another service which depends on the one mentioned above.

This results in a need for user input (a 'Y' and [enter]) to the dependant service to restart aswell. I've spent several hours trying to get the required input sent to the command prompt (mainly using .sendkeys), but somehow I can't get the command prompt window activated (tryed appactivate). I can get the required charaters sent if I manually active the command prompt window first.

Can anyone help me with this? I've added my final attempt at the script below (and yes, I'm very much a novice with scripting :) ). I've left out the part stoping the service, I'm just concentrating on sending the char.

option explicit
Dim objShell
set objShell = WScript.CreateObject("WScript.Shell")
objshell.run "cmd.exe /k title cmd"
wscript.sleep 2000
objshell.appactivate "cmd"
objshell.sendkeys "y"
0
Comment
Question by:farodane
1 Comment
 
LVL 14

Accepted Solution

by:
setasoujiro earned 250 total points
ID: 36560159
it would be easier to go as follows:

net stop "dependant service name"
net restart "backup exec service"
net start "dependant service"

save as .bat
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Redirected folders in a windows domain can be quite useful for a number of reasons, one of them being that with redirected application data, you can give users more seamless experience when logging into different workstations.  For example, if a use…
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now