GAW
(Fresh Scripter)
2010-02-16 05:15 PM
New to KiXtart - but NOT a programmer/Coder - need help w/Trend

I need to run a program (I am sure will need local admin rights) to uninstall Trend version 8. The server for trend OfficeScan8 went south and all clients lost connection - after a week with support they finally suggest to re-install server. I decided to up grade as well so I installed OfficeScan server 10 on another server and deleted the old version8.
Now I can manually uninstall OFCscan from each pc(about 120) then install the new version - works fine - but as a 1 man shop it will be 2 week just doing this. Support gave me a program to use to uninstall, but I need to run it in KiXtart as I cannot control AD. Then I can run another to install OFCScan10.
Server is 2003 and clients are all XP min sp2.

Server = WHCHsrvr2
share = \ofcscan
files = CmnUnins.exe - to uninstall
= Autopcc.exe - to install new
If I don't have a way to check the version of OfficeScan and pass the uninstall program it will uninstall the new version as well...


I appreciate any help.
Glenn


Glenn BarnasAdministrator
(KiX Supporter)
2010-02-16 09:25 PM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

Welcome to Korg!

Kix can certainly help.. I'm guessing that you can either read a registry key or a file path location to determine the version. In some cases, you'd need to read a registry key to locate the install location, and then read the file version. Either way, Kix can do that in just a few lines using the built-in commands.

I don't have access to any systems with Trend, so if you can provide either a standard file or registry path, we can illustrate how to script this.

Glenn


GAW
(Fresh Scripter)
2010-02-17 12:30 AM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

I do not know the registry keys...
The path for the program is:
C:\Program Files\Trend Micro\OfficeScan Client\
Not sure what else you will need here... The ofcscan.ini file will give the version.
=================================================
old version:
[INI_PROGRAM_VERSION_SECTION]
Pattern_Last_Update=20090315002615

PccNT_Version=8.0
PccNT_Last_Update=20090224112218

Pccw16_Version=8.0
Pccw16_Last_Update=20090224112218

Engine31_Version=5.500
Engine31_Last_Update=20090224112218

Program_Version=8.0
Program_Last_Update=20090224112218

EngineNT_Version=8.911.1001
EngineNT_Last_Update=20090301004749
======================================================
and New version:
[INI_PROGRAM_VERSION_SECTION]
Pattern_Last_Update=20100214013419

PccNT_Version=10.0
PccNT_Last_Update=20100204170316

Pccw16_Version=10.0
Pccw16_Last_Update=20100204170316

Engine31_Version=5.500
Engine31_Last_Update=20100204170316

Program_Version=10.0
Program_Last_Update=20100204170316

EngineNT_Version=9.100.1001
EngineNT_Last_Update=20100204175638

I really appreciate the help!

PS. I don't think the rocket made it to Tn that I have seen anyway! ;\)


Glenn BarnasAdministrator
(KiX Supporter)
2010-02-17 01:32 AM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

LOL! Thanks for keeping an eye out!

For your project, ReadProfileString() is your best friend. You can do something like this:
 Code:
$File = 'C:\Program Files\Trend Micro\OfficeScan Client\ofcscan.ini'
$Version = ReadProfileString($File, 'INI_PROGRAM_VERSION_SECTION', 'PccNT_Version')
If Val($Version) < 10
  'Need to upgrade!' ?
  Shell 'Insert Upgrade Command Here'
Else
  'Version 10 or higher - no upgrade needed!' ?
EndIf
This is about as basic as it gets, and having an INI file makes it all that much easier. Kix has built-in functions to read or write ini file values.

Put a ";" in front of the Shell line (comment it to prevent it from running) and give that a try on a few systems. Test it on systems with version 8 and version 10. If you get the correct messages, then you can replace the command string with the uninstall command and remove the comment and run it for real.

Glenn


GAW
(Fresh Scripter)
2010-02-17 02:40 PM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

Wow, that is awesome, I thought it was going to be a lot more confusing than that! I will let you know how it turns out!

Glenn


GAW
(Fresh Scripter)
2010-02-17 10:30 PM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

For the most part it seems to work. A couple I tested didn't seem to finish the uninstall completly -ie delete the directory - and it does require local admin rights. Most of the users here (regretably from past admin) have local admin rights so I think it will work ok.
I found some code from Trend thought the premise was interesting - waiting for the directory to be deleted (could cause an infinate loop)

Create a login script in a GPO using the following command:
@ECHO OFF
IF EXIST "C:\tm_installed.txt" GOTO EXIT

\\\trend\Autopcc.exe

:LOOP
ping -n 60 127.0.0.1 > NUL
IF EXIST "%ProgramFiles%\Trend Micro\OfficeScan Client" GOTO LOOP
\\\ofcscan\Autopcc.exe
ECHO "installed" > "C:\tm_installed.txt"

:EXIT

This is what I am currently using...

;==================================================================
; Check and install if needed - New Trend Micro
;==================================================================
$File = 'C:\Program Files\Trend Micro\OfficeScan Client\ofcscan.ini'
$Version = ReadProfileString($File, 'INI_PROGRAM_VERSION_SECTION', 'PccNT_Version')
If Val($Version) < 10
'Need to upgrade!' ?
'Please wait...uninstalling old software...' ?
Shell '\\whchsrvr2\ofcscan\CmnUnins.exe'
'Installing new software...' ?
Shell '\\whchsrvr2\ofcscan\autopcc.exe'
Else
'Version 10 or higher - no upgrade needed!' ?
EndIf


any more thoughts I am still interested... esp local admin rights...

Glenn


Glenn BarnasAdministrator
(KiX Supporter)
2010-02-17 11:20 PM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

The problem with the system not removing the folder can be solved in other ways. Most uninstall software will not remove files that have customized settings, and thus will not remove the folder.

Doing this in a login script is bad, whether local users are admins or not. It's an admin task, and should be done by an administrator.

Here's how to clone yourself to do this -
1. Modify your script to check the folder -
If Exist('C:\Progra~1\Trend...')
; delete the folder and all contents
EndIf
2. Create a folder on an accessible share somewhere and put Kix32.exe and your uninstall script and EXE there.
3. Test the script on a PC by running
\\server\share\folder\kix32 \\server\share\folder\remove-it.kix
from a command prompt.
Make sure the SHELL command is "\\server\share\folder\remove.exe"
(Change the script and EXE names as appropriate!)

When step 3 works, you can now step behind the curtain and perform your magic - push the command to all computers to run at a scheduled time, using Admin credentials! It's quite simple..
  • Download the Task Scheduler Admin tool from my web site. It's a Kix based script and a tool from the MS resource kit called JT.EXE. JT is a powerful (but cumbersome to use) task scheduling tool, but tsAdm makes it easy to use. Install it on your PC using the Setup command in the package.
  • Create a text file with a list of all computers you want to update, one name per line.
  • Launch the task scheduler tool "tsAdm".
    In the "Computer Name" field, type "BLAST".
    Define a date and time, and the trigger type is "Once"
    Specify "\\server\share\folder\kix32.exe" as the command, and "\\server\share\folder\remove-it.kix" as the argument.
    Specify credentials with admin rights - should be admin rights on the PC and at least User rights to the network share!
    Select the Delete When Done option.
    Click Save - when prompted for a task name, enter "Remove Trend 8"
    The system will prompt for a list of computers - browse to your computer list file.
The task will be pushed to each computer and execute at the defined time, using the defined account credentials. You might want to try a few first, and may even want to deploy this in small batches of 15-25 computers to minimize network overhead.

Using the task scheduler is one of the best, safest, and most reliable methods of performing admin tasks on many computers. tsAdm has been around for a long time, and I use it regularly to perform tasks such as this. It is built on the tcLib UDF library, which is also available on my site.

Glenn


GAW
(Fresh Scripter)
2010-02-18 12:36 AM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

I will check it out - Thanks again for your help!
I don't want to be a programmer but i can see that this could be very beneficial!


Glenn BarnasAdministrator
(KiX Supporter)
2010-02-18 02:26 AM
Re: New to KiXtart - but NOT a programmer/Coder - need help w/Trend

You might find my Intro to Programming helpful - I use it when teaching admin scripting classes. The material is fairly generic, but it uses Kix for the exercises.

Kix is the ideal administrators scripting language, since it has so many commonly needed capabilities built in, is syntactically forgiving, and has a wealth of pre-written UDFs.

Glenn