ok, here it is....

Change the $from to match the exact line of your required from.

I realise that froms can also be forged, but this is not intended for use on non-admin PCs and this should certainly never be advertised. As the mailbox is deleted as soon as the script is run, and only the first email is run, no-one should ever find out...

Another idea, and I might even update the script... leave the script running and polling the email dir for the mailbox file. As soon as the .pbx appears, run the command and delete it.

code:

cls
break on

;
; this program will search for commands from a MS Outlook Express
; mailbox and execute them
;
; The commands must be in an email with a subject line "Remote Execution Request"
; Then each command line must start with ::
;
; An example email:
;
; From: chrismat@ozemail.com.au
; To: chrismat@ozemail.com.au
; Subject: Remote Execution Request
; Body:
;
; Hello,
;
; Please run these commands for me on \\server
;
; ::del c:\temp\*.txt
; ::net send chrism "all done"
;
; thanks, cj
;

; get $source from registry at
;
; HKEY_CURRENT_USER\Identities\{DF8CC2CB-493E-418E-824A-EB4A086C003D}\Software\Microsoft\Outlook Express\5.0
;
; The {DF8CC2CB-493E-418E-824A-EB4A086C003D} might be for me only...
; so have a look in the reg on your PC.
$path=readvalue("HKEY_CURRENT_USER\Identities\{DF8CC2CB-493E-418E-824A-EB4A086C003D}\Software\Microsoft\Outlook Express\5.0", "Store Root")
; other vars and constants
$source=$path+"rer.dbx" ; MS Outlook Express folder that contains the email
$subject="Subject: Remote Execution Request" ; required subject line - case sensitive!!
$from='From: "Chris Matheson" <chrismat@@ozemail.com.au>' ; valid email sender's name and address
$command="::" ; the chars that the commands follow
$output="c:\scan.txt"

; delete previous failed use of this program
del "$output"

; search mailbox for command email
shell 'cmd /c find "$subject" $source > $output'

; if $output is 0 bytes then FIND couldn't find the file
if getfilesize($output)=0
exit
endif

; open scan file
$=open(1, "$output")
if @error<>0
"Error @error occurred accessing $output:" ?
"@serror" ? ?
exit
endif

$bFound="false"
$search=readline(1)
while @error=0
if $search=$subject
$bFound="true"
endif
$search=readline(1)
loop

if $bFound="false"
? "No Remote Execution Requests found, aborting."
$=close(1)
del "$output"
exit
endif

$=close(1)

; found the subject, now look for FROM:
shell 'cmd /c find "From:" $source > $output'

; open scan file
$=open(1, "$output")

$bFound="false"
$search=readline(1)
while @error=0
if $search=$from
$bFound="true"
endif
$search=readline(1)
loop

if $bFound="false"
? "Valid sender not found, aborting."
$=close(1)
del "$output"
exit
endif

$=close(1)

; found the subject and the sender, now look for commands
shell 'cmd /c find /i "$command" $source > $output'

$bFound="false"
$=open(1, "$output")
$search=readline(1)
while @error=0

if instr($search, $command)=1
$bFound="true"
$strip=substr($search, 3, len($search)-2)
shell "cmd /c $strip"
endif
$search=readline(1)
loop

if $bFound="false"
? "No Commands found, aborting."
else
? "Commands executed."
endif

$=close(1)
del "$output" ; delete our text file
del "$source" ; delete the mailbox folder