Solved

Stopping dependant service via script server 2008

Posted on 2011-09-19
1
345 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

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

747 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

11 Experts available now in Live!

Get 1:1 Help Now