Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to stop a service delete files and restart service in a script

Avatar of WeirdFishes
WeirdFishesFlag for Australia asked on
Windows BatchWindows Server 2008IT Administration
17 Comments1 Solution1242 ViewsLast Modified:

I would like some help in creating a Script that can stop a service> delete some files> restart the service.

*I would like to run it from my machine (client, winodws 7)
*The service i want stop and start and files to delete are on a MS 2008 Box
*I would like to use our support account that is part of the Domain admins group
*I have run the content of the script manually on the server in cmd and works fine but doesn't work as a script using runas on my machine.

So far i have

net stop "Service"
del "files path to delete"
net start "Service"

I played around with runas /u: /netonly but it looks like i'm just not getting it right

Thanks for the help in advanced.
Avatar of TechnoChat
TechnoChatFlag of India imageWintel Administrator / Cloud Computing

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 17 Comments.
See Answers