# Kod usuwa zaplanowane zadanie

use Win32::OLE;
$Win32::OLE::Warn = 3;

# ------ KONFIGURACJA SKRYPTU ------
$intJobID = '<IdentyfikatorZadania>'; # np. 1452
$strComputer = '<NazwaSerwera>'; # np. dns01 
# ------ END CONFIGURATION ---------
$objWMI = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2');
$objInstance = $objWMI->Get('Win32_ScheduledJob.JobID=' . $intJobID);
$intRC = $objInstance->Delete;
if ($intRC != 0) {
    print "Nie udao si usunicie zadania z identyfikatorem: $intJobID\n";
}
else {
    print "Z powodzeniem usunito zadanie z identyfikatorem: $intJobID\n";
}
