Get_No_Microsoft_Schedule_Tasks.bat
Citation:
Envoyé par
Gluups
Bon, c'était une tâche planifiée.
Un réveil avec un peu trop de répétitions, que j'avais fini par désactiver, mais quand j'ai restauré l'image du disque j'avais oublié ça.
Je suppose que pour chercher quelque chose dans les tâches planifiées, le plus adapté c'est PowerShell.
:salut:
Je crois que votre problème est bien :resolu: , n'empêche pas de vous partager un script hybrid batch-powershell pour obtenir toutes les tâches planifiées non microsoft sur votre machine, ça peut-être utile à l'avenir pour vous et d'autres membres aussi :king:
Alors juste copier et coller ce bout de code dans votre notepad ou bien notepad++ et enregistrer le sous le nom par exemple Get_No_Microsoft_Schedule_Tasks.bat
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <# : Batch portion
@rem # The previous line does nothing in Batch, but begins a multiline comment block
@rem # in PowerShell. This allows a single script to be executed by both interpreters.
@echo off
Mode 70,3 & Color 0B & echo(
Title Get No Microsoft Schedule Tasks by Hackoo 2022
setlocal
cd "%~dp0"
echo/ & echo/ Please Wait... Getting No Microsoft Schedule Tasks is in Progress...
@for /f "delims=" %%I in ('powershell -noprofile "iex (${%~f0}|out-string)"') do echo %%I
EndLocal
Exit
: end Batch / begin PowerShell hybrid code #>
cls
Function getTasks($path) {
$out = @()
# Get root tasks
$schedule.GetFolder($path).GetTasks(0) | % {
$xml = [xml]$_.xml
$out += New-Object psobject -Property @{
"Name" = $_.Name
"Path" = $_.Path
"LastRunTime" = $_.LastRunTime
"NextRunTime" = $_.NextRunTime
"Actions" = ($xml.Task.Actions.Exec | % { "$($_.Command) $($_.Arguments)" }) -join "`n"
"==============" = "===================================================================================="
}
}
# Get tasks from subfolders
$schedule.GetFolder($path).GetFolders(0) | % {
$out += getTasks($_.Path)
}
#Output
$out
}
$tasks = @()
$schedule = New-Object -ComObject "Schedule.Service"
$schedule.Connect()
# Start inventory
$tasks += getTasks("\")
# Close com
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($schedule) | Out-Null
Remove-Variable schedule
# To show All No Microsoft Scheduled Tasks
$tasks | ? { $_.Path -notmatch "Micro*" } | Out-String -Width 450 | Out-File ".\No_Microsoft_Tasks.txt"
$tasks | ? { $_.Path -notmatch "Micro*" } | OGV -Wait -Title "No Microsoft Tasks"
ii ".\No_Microsoft_Tasks.txt" |