Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Array and process existance

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,38321
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Array and process existance
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Array and process existance - 10/3/2006 9:49:44 PM   
  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

 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Array and process existance Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts