| |
kuehnlm
Posts: 19
Score: 0
Joined: 8/21/2006
Status: offline
|
Hi all, maybe somebody can help me out...? I have got a TXT-file with different information in it. The file looks like that: Host1,C,E Host2,C,D Host3,C,D,F Host4,C,E,F I'm reading this file into an array and can echo the lines to the command line. The script runs locally on each host. My problem is, that I have to do the following: 1. Check, if the name of the local host (where the script is running) is listed in the TXT-File (I have done this with instr(array...) - this works fine) 2. Check, if a special process is running 2a: If process is running - run check in step 2 after 30 seconds again 2b: If process is not running - run process with arrRecord(1), wait 60 seconds and run check in step 2 again. 2c: If process is not running - run process with arrRecord(2) etc. I have two code parts but I don't know how to create one of that: The first part: Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'snapshot.exe'") If colProcesses.Count = 0 Then Wscript.Echo "Snappy is not running." ' Image could run for entry arrRecord(1) ' If Image arrRecord(1) is created, run arrRecord(2)... Else Wscript.Echo "Snappy is running." ' Image has to wait... End If The second part: For x = 1 to Ubound(arrRecord) FileOutputImage.Writeline "Image-Erstellung wird gestartet für Partition " & arrRecord(x) & " auf Server " & strServername FileOutputImage.Writeline strCreateImage = "c:\Tools\Snapshot\Snapshot.exe " & arrRecord(x) & ": D:\Images\" & Date & "\" & strServername & "_" & arrRecord(x) & ".sna -R -W" WSHShell.Run strCreateImage Wscript.Echo "Image sollte jetzt erstellt werden für " & arrRecord(x) & "!" ' Check if process snapshot.exe is running... Finally I just want to create images of different partitions of the machines. The process should only be started if the running process is ended. Thanks for any help. Mel
|
|