Page 1 of 2 12>
Topic Options
#145265 - 2005-08-10 10:06 PM Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
I am trying to get the below command to run ONLY once. It reboots the machine after running so it needs to not run every login. also it needs to detect Windwos XP pro SP2. if not sp2 it shoudl terminate. What I have so far does not work.

If Instr(@PRODUCTTYPE,"Windows XP Professional")
If Instr(@CSD, "Service pack 2")
SHELL '%comspec% /c "CPAU -u domain\username -p password -profile -ex "msiexec /i \\tahoe\packages\mmclientsp2.msi MASIP=192.168.5.40 /qn"'
Endif
Oh yeah it use CPAU to run as with admin rights.

Top
#145266 - 2005-08-10 10:40 PM Re: Proper code to run command once
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
put an "if exist() ... endif" around it to see if the installed app exists, is the simplest method
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#145267 - 2005-08-10 11:05 PM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
Not sure where that would fit in. this is a patch so the files to teh program are already there. I have changed it to this but it doesnt like the If Exists line. says somethign about Missing ) which is there so i dont get it. this shoudl say check windwos ver check SP versiona dn if the main progrma is installed. nto only does it error on me it will not check to see if the patch is installed.

IF EXIST(C:\Program Files\Avaya Modular Messaging\Client\vr.exe)
If Instr(@PRODUCTTYPE,"Windows XP Professional")
If instr(@CSD, "Service Pack 2")
SHELL '%comspec% /c "CPAU -u sssnt\Install -p Install1 -profile -ex "msiexec /i \\tahoe\packages\mmclientsp2.msi MASIP=192.168.5.40 /qn"'
Endif

Top
#145268 - 2005-08-10 11:11 PM Re: Proper code to run command once
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
IF EXIST('C:\Program Files\Avaya Modular Messaging\Client\vr.exe')

if it is a patch, then yu will need to look in the reg to see if it makes a GUID in the add/remove program key.

Otherwise, you will need to make a tag file or reg value to see if it exists prior to install and then set it afterward
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#145269 - 2005-08-10 11:12 PM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
got it with this

If Instr(@PRODUCTTYPE,"Windows XP Professional")
If instr(@CSD, "Service Pack 2")
IF EXIST("c:\Program Files\Avaya Modular Messaging\Client\vr.exe")
SHELL '%comspec% /c "CPAU -u sssnt\Install -p Install1 -profile -ex "msiexec /i \\tahoe\packages\mmclientsp2.msi MASIP=192.168.5.40 /qn"'
Endif

Now all i need is for it to only run once on each machine.

Top
#145270 - 2005-08-10 11:16 PM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
how about if I copy the patch installer to the local machine, have it check if it is existing, and if not run if. hwo the hell would i write that.
Top
#145271 - 2005-08-10 11:22 PM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
tried this and it says Else without IF After the Endif statement

If Exist("c:\MMClientSP2.exe")
Endif
Else
If Instr(@PRODUCTTYPE,"Windows XP Professional")
If instr(@CSD, "Service Pack 2")
COPY "\\tahoe\packages\mmclientsp2.exe" "c:\"
IF EXIST("c:\Program Files\Avaya Modular Messaging\Client\vr.exe")
SHELL '%comspec% /c "CPAU -u sssnt\Install -p Install1 -profile -ex "msiexec /i \\tahoe\packages\mmclientsp2.msi MASIP=192.168.5.40 /qn"'
Endif

Top
#145272 - 2005-08-10 11:42 PM Re: Proper code to run command once
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Because your If/EndIf structure is wrong.

Here is maybe a better example, but not sure what you're really wanting.

Also, please post using the UBB Tags to preserve the formatting of your code.

Code:
If Exist("c:\MMClientSP2.exe")
 ;do nothing?
Else
  If Instr(@PRODUCTTYPE,"Windows XP Professional") And instr(@CSD, "Service Pack 2")
     COPY "\\tahoe\packages\mmclientsp2.exe" "c:\"
     IF EXIST("c:\Program Files\Avaya Modular Messaging\Client\vr.exe")
       SHELL '%comspec% /c "CPAU -u sssnt\Install -p Install1 -profile -ex "msiexec /i \\tahoe\packages\mmclientsp2.msi MASIP=192.168.5.40 /qn"'
     EndIf
  Endif
EndIf


Top
#145273 - 2005-08-10 11:46 PM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
I am trying to get it to skip the bottom command if the file at the begining is there.

the line ;do nothign is my problem. if it finds file xx.exe it shoudl skip to the next set of commands and not install the patch. if i replace ;do nothing? with quit it quits the script adn doe snot run the rest. I want it to install a patch only if it is on windows xp pro with sp2 and only if it hasnt already been installed.

Top
#145274 - 2005-08-10 11:53 PM Re: Proper code to run command once
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well then to stop it if it has already been installed you need to look for something to tell it that it has been installed either by maybe a registry check or a file check, otherwise you're currently not checking anything to see if it has already been installed.
Top
#145275 - 2005-08-11 12:17 AM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
yes by the file it copies to c. the first time it runs it check to see fi that file is on c. if it is not it copies it and runs the package. If it is there it should. end. actually your script above works perfectly. i have .exe instead of msi in teh file it looks for.

THANKS SO MUCH!!!

Top
#145276 - 2005-08-11 12:28 AM Re: Proper code to run command once
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Quote:


Code:

If Exist("c:\MMClientSP2.exe")
;do nothing?
Else






Simplify this to
Code:

If Not Exist("c:\MMClientSP2.exe")


Top
#145277 - 2005-08-11 12:31 AM Re: Proper code to run command once
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well simply because that file was copied there is not a very good indication that it was ever installed.

I would personally look for something more concrete to determine if it was installed. Also you might want to remove the file after a successful update.

Top
#145278 - 2005-08-11 01:02 AM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
I agree that is not the best way but is the easiest and quickest. I wouldn't know where to start as far as patch files. The initial program is easy as I can use it;s executable but the patch jsut updates files. what woudl i use to compare a file version?
Top
#145279 - 2005-08-11 01:17 AM Re: Proper code to run command once
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
GetFileVersion ("file name",”versionfield”)

$Result = GetFileVersion(@LDRIVE + "\Kix32.exe", "ProductVersion" )


Just find a file that is updated and see what the versions are on an updated one and one that is not updated. Then do a compare.

Top
#145280 - 2005-08-11 01:23 AM Re: Proper code to run command once
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
...assuming the file is not in use at the time.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#145281 - 2005-08-11 01:25 AM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
i just compared all the files and none are changed. may be stuck with what i have.

thanks fo ryour help btw.

Top
#145282 - 2005-08-11 01:39 AM Re: Proper code to run command once
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Sorry but I find that difficult to believe that nothing changed.

Is this what you're installing or another update?



AVAYA MODULAR MESSAGING
MM2.0 Service Pack 3 Release Notes

http://support.avaya.com/japple/css/japp...p;PAGE=Document

Top
#145283 - 2005-08-11 01:40 AM Re: Proper code to run command once
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
You can also use REGSHOT to do a before and after update on a system to see what changes in the registry.
Top
#145284 - 2005-08-11 02:05 AM Re: Proper code to run command once
RonM Offline
Fresh Scripter

Registered: 2004-10-11
Posts: 16
http://support.avaya.com/japple/css/japp...5&PAGE=Document
Just thought of the regshot while i was int eh bathroom lol.

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.084 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org