From a07ac3307b69a57298a469102717b790c45a4a0d Mon Sep 17 00:00:00 2001 From: "Michael H.G. Schmidt" Date: Wed, 26 May 2021 23:06:15 +0200 Subject: [PATCH] . --- scripts/A.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 scripts/A.ps1 diff --git a/scripts/A.ps1 b/scripts/A.ps1 new file mode 100644 index 0000000..4c541b2 --- /dev/null +++ b/scripts/A.ps1 @@ -0,0 +1,9 @@ + +$taskName = “The task name”; +$task = Get-ScheduledTask | Where-Object { $_.TaskName -eq $taskName } | Select-Object -First 1 +if ($null -ne $task) { + $task | Unregister-ScheduledTask -Confirm:$false + Write-Host “Task $taskName was removed” -ForegroundColor Yellow +} + +if (Get-ScheduledTask -TaskName $TaskName){Unregister-ScheduledTask -TaskName $TaskName -Confirm $false}