Créer un script d’automatisation
luckydu43 Messages postés 4259 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j’aimerai pouvoir créer un script afin d’automatiser une tâche mais je ne sais pas comment m’y prendre ni quoi écrire dedans.
La tache que j’aimerai automatiser est la suivante:
Exécution de tous les éléments présent dans l’onglet « action » des propriétés de configuration manager (panneau de configuration)
voici une image:
merci pour votre aide
- Créer un script d’automatisation
- Créer un compte google - Guide
- Comment créer un groupe whatsapp - Guide
- Créer un lien pour partager des photos - Guide
- Créer un compte gmail - Guide
- Créer un compte instagram sur google - Guide
2 réponses
Bonsoir,
Voici un script .bat exécutant toutes les actions présentes dans Configuration Manager (du moins celles qu'on voit dans votre capture) :
@echo off color 0a title Actions Config Manager REM ####################################################### REM ############ Elevation de droits via l'UAC ############ REM ####################################################### :elevation REM Vérifie si l'instance est déjà en élévation de droits >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" REM Si l'errorlevel est différent de 0, l'instance n'est pas élevée : il faut le faire :-) if '%errorlevel%' NEQ '0' ( goto affichageDelUAC ) else (goto elevationReussie) :affichageDelUAC echo Set popupUAC = CreateObject^("Shell.Application"^) > "%temp%\elevation.vbs" echo popupUAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\elevation.vbs" "%temp%\elevation.vbs" exit /B :elevationReussie if exist "%temp%\elevation.vbs" ( del "%temp%\elevation.vbs" ) echo. echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo º º echo º Execution des actions de Configuration Manager... º echo º º echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ echo. wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000113}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000103}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000104}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000107}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000108}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000121}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000102}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000101}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000106}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000022}" /NOINTERACTIVE wmic /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000027}" /NOINTERACTIVE echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo º º echo º Appuyez sur une touche pour terminer le script... º echo º º echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ & pause>nul
Ouvrez un bloc-notes, collez le script et enregistrez-le au format ANSI en .bat où vous voulez.
Chaque suite de chiffres correspond à l'identifiant unique d'une action SCCM.
Voici la liste des actions pour l'enrichir ou le modifier, je me suis basé sur cette page pour l'écrire. Par principe j'ai ajouté une section demandant une élévation de droits, je ne peux pas le tester sur mon poste.