Jump to content

Ending tasks for riprep to make an image


Recommended Posts

Win 2003 server has a program called Remote Installation Service (RIS)

This is is similar to Norton ghost... you create a machine and make an image of it on the RIS server. When making the image you must exit a bunch of tasks. The riprep prgram tries to do this but fail miserably. I want to create a program that uses the processlist() and processclose() commans to close any process that is not on my ignore list.

What I have so far is thiss

$list = ProcessList()
$i = 1
Global $fulllist
Do
    $fulllist = $fulllist & $list[$i][0] & "|"
    $i = $i + 1
until $i = $list[0][0]
$listarray = StringSplit ( $fulllist, "|")

$listarray[0] = ($listarray[0] - 1)
_ArrayDisplay( $listarray, "current process list")


Dim $h = 1
For $h = 1 to 30
    Global $g
    For $g = 1 to $listarray[0]
        If $ignore[$h] = $listarray[$g] Then
            _ArrayDelete( $listarray, $g)
        EndIf
    Next
Next

_ArrayDisplay( $listarray, "fixed")

I also have the list of data stored in an array

#include <Array.au3>

Global $ignore[31]
$ignore[0] = "30"
$ignore[1] = "[system process]"
$ignore[2] = "System"
$ignore[3] = "smss.exe"
$ignore[4] = "csrss.exe"
$ignore[5] = "winlogon.exe"
$ignore[6] = "services.exe"
$ignore[7] = "lsass.exe"
$ignore[8] = "rpcss.exe"
$ignore[9] = "spoolsv.exe"
$ignore[10] = "cisvc.exe"
$ignore[11] = "ntmssvc.exe"
$ignore[12] = "scesrv.exe"
$ignore[13] = "dsdtc.exe"
$ignore[14] = "dfssvc.exe"
$ignore[15] = "explorer.exe"
$ignore[16] = "svchost.exe"
$ignore[17] = "systray.exe"
$ignore[18] = "riprep.exe"
$ignore[19] = "cmd.exe"
$ignore[20] = "osa.exe"
$ignore[21] = "msiexec.exe"
$ignore[22] = "wuauclt.exe"
$ignore[23] = "wmiprvse.exe"
$ignore[24] = "ntvdm.exe"
$ignore[25] = "msmsgs.exe"
$ignore[26] = "wpabaln.exe"
$ignore[27] = "ctfmon.exe"
$ignore[28] = "procconmd8.exe"
$ignore[29] = "procconsvc.exe"
$ignore[30] = "processblock"
 _ArrayDisplay( $ignore, "ignore")

I realize I have extra _arraydisplay's n there but that was to see how it operated.

This current setup doesnt really work at all. I think it has something to do with when I delete the element in the list process array.

To explain myself clearer, I have 2 arrays. One that has a list of the process's to ignore and one that has all the current processes. What I tried to do was to have each element in the array compared to the other arra and if a process was found in the ignore list that matched the current process list then it would be removed. Thus leaving only the processwes that need to be ended.

Help me!!!... my brain broke (I want this prog but the 3 hours of sleep I had arent letting me make it) :(

Edited by Wus
Link to comment
Share on other sites

For $h = 1 to 30
    Global $g
    For $g = 1 to $listarray[0]
        If $ignore[$h] = $listarray[$g] Then
            _ArrayDelete( $listarray, $g)
        EndIf
    Next
Next

you can't delete an array element in a for loop, if you use the number of

array elements for the loop counter.

Reason:

Round #1

h=1, g_max=20, number of elements=20

Now, you delete one array element.

Round #2

h=1, g_max=20, number of elements=19

so, $listarray(20) does no longer exist, thus you'll get a runtime error.

Just use a dummy array in the loop.

$dummyarray = $listarray ; <-----   !!!

For $h = 1 to 30
    Global $g
    For $g = 1 to $listarray[0]
        If $ignore[$h] = $listarray[$g] Then
            _ArrayDelete( $dummyarray, $g)  ; <------ !!!
        EndIf
    Next
Next

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Thx... I was too dam tired to make it work

I duno how thatll work tho... wont that delete the wrong cells in the dummy array?

After it delets number 10 all the others will shift over

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...