Someone want to test / review this...

update 1.1
code:
 break on

$computer="wheelerc_2nd"
$appdir="\\ada06\setup$$\apps"
$Folder="Acrobat Reader"
$executable="setup.exe"
$param=""
RemoteInstall($computer, $AppDir, $folder, $executable, $param)

exit

Function RemoteInstall($computer, $appDir, $folder, $executable, $param)
dim $rd, $command
$rd = '%comspec% /c RD /s /q "c:\Temp\$folder" >nul'
$command= '"c:\temp\$folder\$executable $param"'
if right($executable,4)=".msi"
$command='c:\winnt\system32\msiexec.exe /i "c:\temp\$folder\$executable"'
endif
? "Copying Files"
shell '%comspec% /c xcopy "$appdir\$folder" "\\$computer\c$$\Temp\$folder\" /s /v /h /y /i /q'
? "Running exe"
$ = RMTEXEC($computer, $command)
? "adding Runonce key for cleanup"
$ = Runonce($folder,$rd,1,$computer)
endfunction


FUNCTION RMTEXEC($computer, $command)
dim $Connect
$Connect = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer/root/cimv2:Win32_Process")
$RMTEXEC = $Connect.Create($Command)
exit @error
$Connect = 0
ENDFUNCTION

Function RunOnce($title, $Command, optional $systemwide, optional $Computer)
dim $regkey
$regkey='HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce'
select
case $systemwide and $computer
$regkey='\\$computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce'
case not $systemwide and $computer
$sid=RemoteSid($computer)
$regkey='\\$computer\HKEY_USERS\'+$SID+'\Software\Microsoft\Windows\CurrentVersion\RunOnce'
case not $systemwide
$regkey='HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce'
endselect
$runonce=writevalue($regkey,$Title,$command,'REG_SZ')
$runonce=@ERROR
endfunction

Function RemoteSid($computer, optional $remoteusername)
dim $sid, $logonname, $index, $HKUsidSMWCVE
$index=0
:sidloop
$sid=enumkey("\\$computer\HKEY_USERS\",$index)
if not @error
$HKUsidSMWCVE = "HKEY_USERS\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer"
$LogonName=readvalue("\\$computer\$HKUsidSMWCVE","Logon User Name")
if $remoteusername=$LogonName or not @error
$RemoteSid=$sid
exit 0
return
else
$index=$index+1
$sid=''
goto sidloop
endif
endif
endfunction



[ 19. December 2002, 16:54: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask