fb
Homepage 5 How-to Articles 5 Delete Scheduled Task with PowerShell on Windows

Delete Scheduled Task with PowerShell on Windows

Manage remote endpoints, deploy software and patches with Action1 cloud RMM solution.

Sign up and use free on up to 50 endpoints with no functionality limits or expiration.



May 3, 2019

It is often required to perform periodic scheduled maintenance tasks in automatic mode without human intervention. This can be checking for updates, creating backup copies of critical files, running administrative scripts, etc. For scheduling and automatic execution of tasks in the Windows environment, the standard Task Scheduler tool is provided. The Task Scheduler ensures the execution of pre-prepared tasks at a specific time, or when certain events occur, once or at intervals, in the context of system or user accounts. We can create or delete scheduled task with PowerShell cmdlets, using command line scripts, WSH scripts, or applications.

Unlike previous versions of Windows, Windows Vista, 7, 8, 10 contain an extensive library of pre-configured tasks. These tasks carry out a wide range of operations providing system maintenance and maintaining it in working condition. In addition, the Task Scheduler in these operating systems has become a component necessary for normal operation, which cannot be disabled by standard means.

This is a much more flexible code, Unlike Unregister-ScheduledJob cmdlet , which allows you to access only jobs in a folder: Task Scheduler Library\Microsoft\Windows\PowerShell\ScheduledJobs. That script allows you to delete a task from any folder in Windows Task Scheduler.

Firstly Start Windows PowerShell

Click Start, type PowerShell, and then click Windows PowerShell

Step 1 to Delete Scheduled Task with Powershell Cmdlet is to start Powershell

Using Cmdlet to Delete Scheduled Task with Powershell

Cmdlets are specific PS commands that hide a wide variety of functions. The commands built into the interpreter are implemented on the basis of the “verb-noun” principle, for example, Get-Process (obtaining a list of processes). This solution allows you to understand the essence of the team already from its name (in English).

You can create scripts in any text editor (it is better to stop at Win, Notepad ++ or the like, with syntax or verification support) or in PowerShell ISE.

Next, you need to save the following code with the extension ps1 through the File menu.

# create Task Scheduler COM object

$TS = New-Object -ComObject Schedule.Service

# connect to local task scheduler

$TS.Connect($env:COMPUTERNAME)

# get tasks folder (in this case, the root of Task Scheduler Library)

$TaskFolder = $TS.GetFolder(“\”)

# get tasks in folder

$Tasks = $TaskFolder.GetTasks(1)

# define name of task to delete

$TaskToDelete = “MyTask”

# step through all tasks in the folder

foreach($Task in $Tasks){

if($Task.Name -eq $TaskToDelete){

Write-Host (“Task “+$Task.Name+” will be removed”)

$TaskFolder.DeleteTask($Task.Name,0)

}

}

Then you need to run it. This is done in three ways:

  • Write the full path to the script in PowerShell (or ISE)
  • Via the context menu of the ps1 file
  • Open the script in PowerShell ISE and press F

Delete Scheduled Task via Microsoft Management Console Snap-ins

To start mmc.exe, you can use the main menu Control Panel – Administrative Tools – Computer Management – Task Scheduler, or Run (Win + R combination) – taskschd.msc.

open Task Scheduler

In the left part of the main window, lists of tasks are displayed, sorted according to their purpose, in the form of a folder structure. The middle part displays information about the status of tasks and their properties. The right side displays a menu of actions that are valid for tasks.

Delete Scheduled Task with Powershell. Task scheduler interface

In the console tree, locate and select the task folder that contains the task that you want to delete. Then select the task you want to delete in the console window. In the Actions pane, click Delete and confirm Delete dialog box.

Delete task in MMC

Delete Scheduled Task Using Command Line

Open a command prompt window as an administrator: right-click on the “Start” menu and select “Command Prompt (Administrator)”;

Open a command prompt as an administrator

Use following command:

schtasks /Delete /

To view help for this command, type:

schtasks /Delete /?

Consider using Action1 to delete scheduled task if:

  • You need to perform an action on multiple computers simultaneously.
  • You have remote employees with computers not connected to your corporate network.

Action1 is a cloud-based platform for patch management, software deployment, remote desktop, software/hardware inventory, endpoint management and endpoint configuration reporting.

Related Articles

How To Delete User Profiles Remotely with PowerShell

When a user logs onto the computer for the first time (not via the network to access shared folders or printers), Windows creates a user profile. Among its contents are the NTUSER.DAT file (user profile settings), user-specific folders (My Documents, Desktop, etc.),...

About Action1 RMM

Action1 RMM is a cloud-based IT solution for remote monitoring and management, patching, and remote support.

Start your free two-week trial of Action1, or use RMM tools for free forever on 50 endpoints with no functionality limitations!



0 Comments

Submit a Comment

Your email address will not be published.

cloud patch management solutions action1

MSP Solution

Centralize endpoint management and boost efficiency of IT service delivery.

automated server patch management action compliance

Patch Management

Identify and deploy missing OS and third-party software updates.

cloud software deployment tools windows

Software Deployment

Distribute software and updates across managed endpoints.

software distribution tools software inventory action1

IT Asset Inventory

Keep a detailed inventory and manage hardware and software assets.

web client remote desktop

Remote Desktop

Support users via seamless remote desktop connection.

web based rdp client

Unattended Access

Provide administrative support and manage remote devices.

automated patch management action1

Endpoint Management

Run PowerShell, custom scripts, reboot computers and restart services.

API integrations action1

RESTful API

Integrate Action1 RMM to your IT ecosystem.

computer inventory tool for compliance

Reports and Alerts

Conduct endpoint security audits with comprehensive reporting.