I need to find tasks which runs using SYSTEM and delete rest of the tasks running using any other account
I was trying to find the job first, then unregister, but not getting any filters to do that.
Get-ScheduledTask -TaskName "SPOC_Inventory"
Need help in this
CodePudding user response:
Try this (without -whatif):
PS C:\> Get-ScheduledTask SPOC_Inventory | ? {($_.Principal.UserId -ne "SYSTEM")}| Unregister-ScheduledTask -WhatIf
Enjoy tom