Solved

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

Posted on 2013-11-04
1
1,399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 54

Accepted Solution

by:
McKnife earned 500 total points
ID: 39622393
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy delete file if connection drops. 2 33
Changing Share Location 1 21
Blocking Microsoft Edge From Running? 14 56
Clone drive for rack Server 4 37
Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Know what services you can and cannot, should and should not combine on your server.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

740 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