Test-ScheduledTaskFolder – Script in TechNet Script Gallery

In the TechNet Scripy Gallery I received the request if it was possible to create a function that can test if a certain folder exists in task scheduler. For this purpose I have created a new function: Test-ScheduledTaskFolder.

This function has two parameters, -ComputerName and -TaskFolder which can be used to identify if a scheduled task folder exists on a local or remote system. The script requires administrative permissions to be able to run because the Schedule.Service ComObject is used and administrative credentials are required to access this particular object.

Here are some examples of how to use this function to collect information about scheduled task folders:

.EXAMPLE   
Test-ScheduledTaskFolder -TaskFolder \Microsoft

Description 
-----------     
Tests if the \Microsoft folder exists on the local system

.EXAMPLE   
Test-ScheduledTaskFolder -ComputerName server01 -TaskFolder \Microsoft,\Microsoft\Windows\RAS

Description 
-----------     
Tests if the \Microsoft and \Microsoft\Windows\RAS folders exists on server01

.EXAMPLE   
'server01','server02' | Test-ScheduledTaskFolder -TaskFolder \CustomTaskFolder

Description 
-----------     
Uses pipeline to verify if the \CustomTaskFolder exists on server01 and server02

The complete function is available in the TechNet Script Library. To view this script or to participate in the discussions about this script either comment here or in the TechNet Script Library.

TechNet Script Library
My entries in TechNet Script Gallery
Test-ScheduledTaskFolder
Share

Leave a Reply

Your email address will not be published.