0

I read that Local system Account has maximum privileges to access all the local resources. But still I could not create a scheduler task while running my application as a service. When I run my application as administrator(cmd),I was able to create a scheduler task

schtasks /create /sc minute /mo 20 /tn "Tesk Check" /tr "C:\run.bat"

When I run this command as a service,I got this error

No mapping between account names and security IDs was done

Did I miss anything?

Vignesh
  • 31
  • 8
  • The local system account doesn't have all the infrastructure associated with a real account, so some functionality isn't available ... but in this particular case, it works fine for me, both on Windows 7, 8.1, and 10. I was using `psexec` to run the command in the context of a service, as local system. – Harry Johnston Jun 27 '17 at 22:24
  • 1
    I suggest you try using `psexec` and see if that works for you; if it does, there might be an issue with the configuration of your service. As a last resort, you might even be able to work around the problem by calling `psexec` *from* your service to run `schtasks`. :-) – Harry Johnston Jun 27 '17 at 22:26
  • Thanks @HarryJohnston. PsExec works fine.I may need to find any configuration mistake in my service – Vignesh Jun 28 '17 at 05:24
  • 1
    Try running `whoami /all` both via `psexec` and via your service and compare the results. – Harry Johnston Jun 28 '17 at 09:00
  • from result I can see that,PsExec runs the command as "Admin" user and My service runs the command as "nt authority\system". Here is the output: https://play.golang.org/p/6y5kWKLD-X – Vignesh Jun 28 '17 at 10:19
  • 1
    D'oh! Sorry, I should have explained: you need to use the `-s` flag to `psexec` if you want it to run the command as local system. Does it still work with `-s` ? – Harry Johnston Jun 28 '17 at 21:57
  • Hi @HarryJohnston,If I run Psexec with "-s" ,It could not add task to schtasks.Hence Only Admin user can access schtasks ;) – Vignesh Jun 29 '17 at 05:01
  • That's puzzling, because it works for me. Perhaps your security software is interfering? Or there is some other difference between our systems; I'm in a Active Directory domain, and that could make a difference I guess. – Harry Johnston Jun 29 '17 at 05:12
  • Local system Account have all the privileges in "Active Directory". ref:- https://stackoverflow.com/questions/510170/the-difference-between-the-local-system-account-and-the-network-service-acco I am not in a Active Directory.So I have to run my service as Admin I guess – Vignesh Jun 29 '17 at 05:56

0 Answers0