Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-11-04
1
Medium Priority
?
1,499 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 56

Accepted Solution

by:
McKnife earned 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

This article explains how to install and use the NTBackup utility that comes with Windows Server.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

670 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