I am trying to grant some permissions for «NonAdmin» user for «Task Scheduler».
If you execute this command:
PS > C:\Windows\System32\sc.exe queryex type= service state=all
you can find that «Task Scheduler» service name is «Scheduler»:
SERVICE_NAME: Schedule
DISPLAY_NAME: Task Scheduler
Then I tried to run simple command to display existing rights:
PS >.\subinacl.exe /Service Schedule /display=dacl
Tried to grant some rights:
PS >.\subinacl.exe /Service Schedule /grant=NonAdmin=R
But both commands are throwing Access is denied:
Schedule - OpenService Error : 5 Access is denied.
Elapsed Time: 00 00:00:00
Done: 1, Modified 0, Failed 1, Syntax errors 0
Last Done : Schedule
Last Failed: Schedule - OpenService Error : 5 Access is denied.
My environment:
OS: Windows 8.1 Enterprise;
Workgroup: connected to domain (also tried on VM not connected to domain — same access denied); I am administrator; I run PowerShell as administrator.
How I can solve this «Access denied» issues and grant some rights for NonAdmin user for the «Task Scheduler» ?
Updated 28/11/2017:
With RbMm help I gave permissions for the use, he can create new scheduled task now. One problem left that he can`t delete/remove that created task.
I giving all most all grants to the user:
"(A;;GAGRGWGXRCSDCCDCLCSWRPWPDTLOCRSDRCFAFRFWFX;;;<USER_SID>)"
But I still get this error when try to delete/remove scheduled task:
The error returned is: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Notes:
- This is domain user.
- I tried to give permissions for the %windir%\Tasks for that user, but it did not helped.
What I am missing, why user can`t delete task?
I’m writing a script that periodically checks that certain services are running on remote workstations. I’m having a devil of a time getting an «SC \workst1 query» command working from one test machine to another. Both machines are running XP pro SP3. Neither is part of a domain. Both are in the same workgroup, and the administrator accounts have the same passwords.
I keep getting the «[SC] OpenSCManager FAILED 5: Access is denied» message, from either workstation to the other. I have tried using elevated privileges on both. Windows firewall software is turned off. There are no messages are showing up in the Event security logs. When (as administrator) I try going to «Computer Management» -> «connect to another computer» and access the remote services I get «Error 5 Access is denied».
I can set up a filesystem share between the two machines successfully, and «net use \workst1\IPC$ /user:Administrator» completes successfully, but the SC query still fails. I’m using IP addresses and not hostnames in these commands, but that doesn’t help. I don’t know what else to try. Thanks for the help.
asked Nov 1, 2013 at 15:56
1
Try to run the commans as a Administrator
start-> (type cmd in search box), right click on cmd, Run as a administrator -> execute your command
answered May 6, 2015 at 20:49
RamkrishnaRamkrishna
4094 silver badges5 bronze badges
You must have administrative rights on the remote machine.
Moreover you must access the drive before calling «sc».
This can be achieved in command line using
net use \\remotemachine\admin$ <password> /user:<username>
admin$ is a hidden shared drive accessible to administrators that «sc» uses to control services.
answered Jun 11, 2015 at 17:41
TeriblusTeriblus
7896 silver badges17 bronze badges
I was having the same issue today trying to check if a service is enabled remotely.
I could solve the issue modifying the User Account Control for remote restrictions in windows:
To disable UAC remote restrictions, follow these steps:
- Click Start, click Run, type
regedit
, and then press ENTER. - Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
- If the
LocalAccountTokenFilterPolicy
registry entry does not exist,
follow these steps:
On theEdit
menu, point toNew
, and then clickDWORD Value
. TypeLocalAccountTokenFilterPolicy
, and then press ENTER.
Right-clickLocalAccountTokenFilterPolicy
, and then clickModify
. In theValue
data box, type1
, and then click OK. - Exit Registry Editor.
More information about this solution in this site.
Greg K
10.8k10 gold badges45 silver badges62 bronze badges
answered May 31, 2017 at 21:30
afonteafonte
9389 silver badges17 bronze badges
1
Your user should be remote, from Manage and Local users and groups
answered Nov 6, 2013 at 16:31
The UAC issue is obvious you have to pull down the lever for UAC setting
Also while installing the services you can use the following command
SC create SERVICENAME DisplayName= «DISPLAYNAME» binPath= «PATH OF EXE» start= disabled type= share
answered Dec 11, 2018 at 21:43
- Remove From My Forums
-
Question
-
hiii
i just run the command SC delete filename to delete that file but i am geting access denied message
along with [sc] openservice failed 5 error.
my os is windows 7.
can any help me to run this command successfully.
thanx
sanjay
-
Edited by
Wednesday, May 30, 2012 9:40 AM
-
Moved by
Bob Wu-MT
Thursday, May 31, 2012 5:34 AM
command related issue (From:Windows Forms General)
-
Edited by
Answers
-
How do you start the command? Are you sure that you start it with administrative rights? (E.g. from a CMD window that you started with administrative rights)
With kind regards,
Konrad
-
Proposed as answer by
Arthur Xie
Thursday, May 31, 2012 8:48 AM -
Marked as answer by
Arthur Xie
Thursday, May 31, 2012 8:49 AM
-
Proposed as answer by
- Remove From My Forums
-
Question
-
hiii
i just run the command SC delete filename to delete that file but i am geting access denied message
along with [sc] openservice failed 5 error.
my os is windows 7.
can any help me to run this command successfully.
thanx
sanjay
-
Edited by
Wednesday, May 30, 2012 9:40 AM
-
Moved by
Bob Wu-MT
Thursday, May 31, 2012 5:34 AM
command related issue (From:Windows Forms General)
-
Edited by
Answers
-
How do you start the command? Are you sure that you start it with administrative rights? (E.g. from a CMD window that you started with administrative rights)
With kind regards,
Konrad
-
Proposed as answer by
Arthur Xie
Thursday, May 31, 2012 8:48 AM -
Marked as answer by
Arthur Xie
Thursday, May 31, 2012 8:49 AM
-
Proposed as answer by
[SC] OpenSCManager FAILED 5: Access is denied.
or above error might arrive on SC manager for any operation like Start or Stop or Delete of a given service.
SC Start
SC DELETE
Resolution
Running SC commands on Windows service require Admin privileges.
Kindly run your CLI/Command prompt in Admin Mode to fix the issue.
Once done you shall see all the commands working !
References:
- Learn SCM � Service Console commands
Do you have any comments or ideas or any better suggestions to share?
Please sound off your comments below.
Happy Coding !!
References:
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published best practices and guidelines for software design and development.