GPO Scheduled Task - Taskkill

js0873x
js0873x used Ask the Experts™
on
I want to deploy a group policy to run a scheduled task at 9 PM each night to run a taskkill command. I only need it executed if the user is logged on, and I'd prefer to not have to enter credentials for the command that might change later, even though that's not as big a deal. I've had a devil of a time getting it to deploy, using either user configuration or computer configuration. Basically, I can't get anything to work so far. I only want it to run based on the user logged in, not at a whole machine level. What's the proper way of getting a command scheduled for users that I've added to a security group to run this command at a certain time?

BTW, I've noticed that whenever I establish a time in in AD it puts it one hour ahead of the time I specified, even though I see nothing at the server level that has inconsistencies with DST or the like.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
You should be able to load up Task Scheduler and configure everything from there. Have you created a script to run for this task? If so, you should be able to setup a scheduled time to run the script and enact it upon a security group. What steps have you taken so far in an attempt to run the taskkill operation?

Author

Commented:
Here's what I did:

I set up a security group  and added 3 users to it
I added a GPO and linked it to the OU with security filtering to Authenticated Users (Read) and the new security group
The GPO used User Configuration / Preferences / Control Panel Settings / Scheduled Tasks
The scheduled task does not have "run as" so as to not need credentials (even though I've tried credentials without much luck either)
The task is under Run: taskkill with the parameters it needs as arguments
Distinguished Expert 2017

Commented:
What is the result of your setting?
Another option using a user GPO and login/logout process
Login will create the schtasks and schedule it
Logout will delete the task.

specifics are missing, are you trying to force user to logoff.

Your issue might be the reference to the batch file where taskkil is envoked or the parameters you are setting with your schedule get misinterpreted ir running into an issue...
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Author

Commented:
How do you create a scheduled task at the login time and delete it at log off?  

And an option to force a log off might be decent too, although I'd only want that on certain machines, not necessarily tied to the user.

The taskkill command I'm wanting to issue is simple. It's like this: Taskkill /IM prowin32.exe /F

Commented:
How are you configuring the GPO? What are you using to launch the taskkill command when you schedule the task? Batch? When the task runs, do you see any corresponding errors in the Event Log? Does the task attempt to run at all?

Author

Commented:
I believe it attempted to run but I got this in the event viewer:

The user 'FIMS Log Off at 10 PM' preference item in the 'FIMS Log Off at 10 PM {1327EFB3-7D06-48D4-BA58-63C5D78FA352}' Group Policy object did not apply because it failed with error code '0x80070005 Access is denied.' This error was suppressed.
Commented:
Unfortunately, the error you're receiving is due to authentication. So for this GPO to run properly, you'll either need a credential for it to run against or it would need to run on an account that has that access. Likely your GPO is just fine, but it doesn't have the elevation to perform the task.
Seth SimmonsSr. Systems Administrator

Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: William Miller (https:#a42348990)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

seth2740
Experts-Exchange Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial