We use Radia for software distribution. I need to kick-off a Radia "connect" so it will install software before ending my task sequence.
The way it works, a command line is run to have it call back to the server. It launches a few different processes, but RADPINIT.exe is the only one that is open for the duration of the package installs, and closes when complete, with a caveat.
This RADPINIT process closes and reopens at the end each package, so my attempts to make MDT wait until RADPINIT closes have not worked.
I got some help from jrv in the Scripting Guy forums, but that forum isn't very kind to scripting novices. I was essentially kicked out and told to go learn PowerShell better. :)
This is the script he helped me with:
$CMD = 'c:\Program Files (x86)\Novadigm\radntfyc.exe'
$arg1 = 'LOCALHOST'
$arg2 = 'Radskman.exe'
$arg3 = 'cat=prompt,ulogon=n,hreboot=y,context=m,mname=radia,dname=SOFTWARE,ip=radia.domain.com,port=3464,uid=$MACHINE,startdir=SYSTEM,ind=y,cop=y,log=software_connect.log'
$Retries = 5& $CMD $arg1 $arg2 $arg3
Sleep 5
$Retries = 5
while(1){
if(Get-process Radpinit)
{sleep 5}
else{exit}
}
This script has a couple of flaws and if anyone can help me make some modifications I would appreciate it.
What this script does:
1. Starts a While loop.
2. If Get-Process finds Radpinit it sleeps for 5, then checks again, and again, etc.
3. If it isn't running, it launches my CMD, sleeps 5, then exits.
The first problem is that it launches my CMD AFTER running the while loop (Function before CMD / non-liner script processing).
The 2nd problem is that it doesn't have any method of dealing with the brief period when RADPINIT may be between packages.
What I need it to do:
Essentially, I need to put the While loop, inside a Retry loop of some kind. But I can't figure it out. Every example that seems similar doesn't work the way I expect when I try to adapt it to this script.
Run my CMD first, then sleep for 5. (Or just let the proposed retry loop take care of this)
Start the while loop. If Get-Process finds RADPINIT, sleep 5 and start over. It it DOESN'T find RADPINIT running, sleep 5 and try again 3 times. If found on one of those 3 retries, restart the retry counter.
So, for ex:
1. Script Start
2. Run Radia CMD
3. Sleep 5
4. Start While Loop, Get-Process = RADPINIT running, sleep 5.
5. Restart While Loop, Get-Process = RADPINIT running, sleep 5.
6. Restart While Loop, Get-Process = RADPINIT = NOT running, sleep 5.
7. Retry 1 in While Loop, Get-Process = RADPINIT running, sleep 5.
8. Restart While Loop, Get-Process = RADPINIT = running, sleep 5.
9. Restart While Loop, Get-Process = RADPINIT = NOT running, sleep 5.
10. Retry 1 in While Loop, Get-Process = RADPINIT NOT running, sleep 5.
11. Retry 2 in While Loop, Get-Process = RADPINIT NOT running, sleep 5.
12. Retry 3 in While Loop, Get-Process = RADPINIT NOT running, EXIT.
Any assistance appreciated!
-Matt
There's no place like 127.0.0.1