Retrieving and deleting scheduled tasks

After having deployed Google Chrome to several of our terminal servers I discovered the Google Update tasks that are automatically installed. Since our servers do not have direct access to the internet anyway I thought I’d get rid of the tasks.
Naturally I can do this one server at a time, but why not use PowerShell to do this?

So I wrote two functions with regards to scheduled tasks: Get-ScheduledTasks and Remove-ScheduledTasks.
Both functions are compatible with Windows 2003 and Windows 2008 task schedulers. They allow for wildcard searches, recursive searches and hidden searches.
Get-ScheduledTasks returns a PSObject for each task that matches the search pattern, which allows for easy exporting.
Just to create a simple report all I had to do was this:

In the Excel file I can review the results and remove any results I do not want deleted, so that I can use the Excel file again as input for Remove-ScheduledTasks!

Both functions support Verbose output and the Remove-ScheduledTasks function supports the -WhatIf parameter.
Here is the Get-ScheduledTasks function:

And the Remove-ScheduledTasks function:

Tagged . Bookmark the permalink.

Comments are closed.