1 2 3 4 5 6 7 8 9 10 11 12 13 14
| $wshell = New-Object -ComObject Wscript.shell
$result = $wshell.popup(
"Mise a jour bios disponible, Appuyer sur ok pour valider, Annuler pour la reporter dans 15 minutes", 0,
"Mise a jour de votre materiel informatique", 1
)
if ($result -eq 1) {
$wshell.popup("GO pour mise a jour", 0)
} else {
$myself = $script:MyInvocation.MyCommand.Path
$action = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument '-Noninteractive -WindowStyle Hidden -File $myself'
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(15)
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "mytask" -Description "re-exécution dans 15min"
} |
Partager