Brian Gorsky
asked on
Unable to schedule a task for all users on a shared machine
I had this question after viewing How do you run a GPO script batch file as an administrator.
I can't get scheduled task to run for all users. I tried setting it up as an administrator, running it with highest priv and running it as the local admin. When I log on as a regular user, it doesn't run and when I open Task Scheduler as that user, I don't see the task.
I can't get scheduled task to run for all users. I tried setting it up as an administrator, running it with highest priv and running it as the local admin. When I log on as a regular user, it doesn't run and when I open Task Scheduler as that user, I don't see the task.
ASKER
David- I checked the history and it appears the task is running. I found that the issue appears to be with the batch file it is running. For some reason the batch file runs fine when I am logged in (as an admin) but when I try to run it as a regular user, even running it as an admin, it doesn't work.
I guess I will close this and open another topic unless you recommend otherwise.
I guess I will close this and open another topic unless you recommend otherwise.
Your batch, share it, please.
@David: the system account is not being impersonated, no. That checkbox only means elevation.
ASKER
I am trying to remove options from right-click on Start button in Win 10 by deleting the shortcuts from the folders they look to.
::Batch file to delete the contents on the listed sub-folders and remove those commands from the start button right-click menu
@echo off
DEL /F C:\Users\%username%\AppData\Local\Microsoft\Windows\WinX\Group2\*.lnk
DEL /F C:\Users\%username%\AppData\Local\Microsoft\Windows\WinX\Group3\*.lnk
Run it as %logonuser%, not as admin and it will just work
ASKER
@mcknife - It doesn't work and from what I am reading that variable only works in a GPO.
That being said, I created a GPO (User Config > Preferences > Windows Settings) as follows trying to delete all .lnk files in the folders and even trying to delete the folders themselves. Nothing seems to work. Thoughts?
That being said, I created a GPO (User Config > Preferences > Windows Settings) as follows trying to delete all .lnk files in the folders and even trying to delete the folders themselves. Nothing seems to work. Thoughts?
The preference items that your screenshots show need the variable %userprofile% instead of %logonuser%.
ASKER
@McKnife - That did it! Just curious though as to when %logonuser% could be used?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to you both. I learned a lot.
in the task triggers did you select at logon, any user? If you have set run with highest privileges the user will not see it running since it will be running as SYSTEM and not in the users context. enable task history, login as a different user, wait a minute or so. switch to an administrative user now check the task histiry