Hi @Saravanaraj-6475 ,
please try this:
if ((Get-ScheduledTask -taskname test | Select-Object -ExpandProperty State) -notmatch "disabled") {
Disable-ScheduledTask -taskname test
}
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten