Solved

Trying to Programmatically Stop Task Scheduler - "System Error 5 has occured"

Posted on 2013-11-04
1
1,311 Views
Last Modified: 2013-11-04
I am simply trying to execute a C# program that will run a "net stop schedule" from the command line (basically I need to stop the scheduled tasks briefly while this code executes and then re-start afterwards).

Starting an elevated or normal command prompt and typing this command manually results in this output:

System error 5 has occurred.

Access is denied.

Open in new window


I've seen some fixes on the internet about changing a registry value from 2 to 4 but that completely disabled the service and wouldn't allow it to start.

Any ideas?
0
Comment
Question by:street9009
1 Comment
 
LVL 53

Accepted Solution

by:
McKnife earned 500 total points
Comment Utility
Easy: that command needs to be run as system, not as administrator. So elevation alone is not enough. Running as system can be achieved using
psexec -s -i net stop schedule
for example.
0

Featured Post

How does your email signature look on mobiles?

Do your employees use mobile devices to reply to emails? With mobile becoming increasingly important to the business world, it is in your best interest to make sure that your email signature looks great across all types of devices.

Join & Write a Comment

Every now and then, Microsoft does something that totally impresses me. It doesn't happen often, but in this case I must say I am thoroughly impressed with Windows Server Backup. One of the long time issues with Windows Backup has been the ability t…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

744 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

12 Experts available now in Live!

Get 1:1 Help Now