2010-05-18 11 views
1

J'ai un script sur vbscriptScript pour le script d'exécution

Dim WSHShell, WinDir, Value, wshProcEnv, fso, Spath  

Set WSHShell = CreateObject("WScript.Shell")  


Dim objFSO, objFileCopy  
Dim strFilePath, strDestination  

Const OverwriteExisting = True  
Set objFSO = CreateObject("Scripting.FileSystemObject")  
Set windir = objFSO.getspecialfolder(0)  
objFSO.CopyFile "\\dv.rt.ru\SYSVOL\DV.RT.RU\scripts\shutdown.vbs", windir&"\", OverwriteExisting  

strComputer = "."  
Set objWMIService = GetObject("winmgmts:" _  
    & "{impersonationLevel=impersonate}!\\" _  
    & strComputer & "\root\cimv2")  
JobID = "1"  

Set colScheduledJobs = objWMIService.ExecQuery _  
    ("Select * from Win32_ScheduledJob")  
For Each objJob in colScheduledJobs  
objJob.Delete  
Next  

Set objNewJob = objWMIService.Get("Win32_ScheduledJob")  
errJobCreate = objNewJob.Create _  
    (windir & "\shutdown.vbs", "********093000.000000+660", _  
     True, 1 OR 2 OR 4 OR 8 OR 16 OR 32 OR 64, ,True, JobId) 

Comment faire que shutdown.vbs ne couriez pas une fois à 9h30, mais pour courir 9h30 à 12:00

+0

Veuillez trouver la mise en forme du code, ou cliquez sur le point d'interrogation pour obtenir de l'aide. – Gabriel

+1

Crossposted ici: [ServerFault] (http://serverfault.com/questions/142869/script-for-run-script-on-vbs), [ServerFault (fermé)] (http://serverfault.com/questions/ 141357/script-for-run-script-closed) et [SuperUser] (http://superuser.com/questions/142355/script-for-run-script-on-vbs). –

+0

Je ne comprends pas votre question "Comment faire que shutdown.vbs ne s'exécute pas une fois à 9h30 mais exécute de 9h30 à 12h00." Pourriez-vous élaborer un peu? marc – user235218

Répondre

0
  • Modifier votre script shutdown.vbs pour vérifier l'heure - si c'est entre 9:30 et 12:00, shutdown
  • Planifiez deux tâches pour exécuter le script d'arrêt: une qui s'exécute à 9h30 et une qui s'exécute au démarrage du système.