RonM
(Fresh Scripter)
2005-08-10 10:06 PM
Proper code to run command once

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.


Radimus
(KiX Supporter)
2005-08-10 10:40 PM
Re: Proper code to run command once

put an "if exist() ... endif" around it to see if the installed app exists, is the simplest method

RonM
(Fresh Scripter)
2005-08-10 11:05 PM
Re: Proper code to run command once

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


Radimus
(KiX Supporter)
2005-08-10 11:11 PM
Re: Proper code to run command once

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


RonM
(Fresh Scripter)
2005-08-10 11:12 PM
Re: Proper code to run command once

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.


RonM
(Fresh Scripter)
2005-08-10 11:16 PM
Re: Proper code to run command once

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.

RonM
(Fresh Scripter)
2005-08-10 11:22 PM
Re: Proper code to run command once

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


NTDOCAdministrator
(KiX Master)
2005-08-10 11:42 PM
Re: Proper code to run command once

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



RonM
(Fresh Scripter)
2005-08-10 11:46 PM
Re: Proper code to run command once

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.


NTDOCAdministrator
(KiX Master)
2005-08-10 11:53 PM
Re: Proper code to run command once

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.

RonM
(Fresh Scripter)
2005-08-11 12:17 AM
Re: Proper code to run command once

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!!!


Witto
(MM club member)
2005-08-11 12:28 AM
Re: Proper code to run command once

Quote:


Code:

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






Simplify this to
Code:

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



NTDOCAdministrator
(KiX Master)
2005-08-11 12:31 AM
Re: Proper code to run command once

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.


RonM
(Fresh Scripter)
2005-08-11 01:02 AM
Re: Proper code to run command once

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?

NTDOCAdministrator
(KiX Master)
2005-08-11 01:17 AM
Re: Proper code to run command once

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.


Les
(KiX Master)
2005-08-11 01:23 AM
Re: Proper code to run command once

...assuming the file is not in use at the time.

RonM
(Fresh Scripter)
2005-08-11 01:25 AM
Re: Proper code to run command once

i just compared all the files and none are changed. may be stuck with what i have.

thanks fo ryour help btw.


NTDOCAdministrator
(KiX Master)
2005-08-11 01:39 AM
Re: Proper code to run command once

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


NTDOCAdministrator
(KiX Master)
2005-08-11 01:40 AM
Re: Proper code to run command once

You can also use REGSHOT to do a before and after update on a system to see what changes in the registry.

RonM
(Fresh Scripter)
2005-08-11 02:05 AM
Re: Proper code to run command once

http://support.avaya.com/japple/css/japp...5&PAGE=Document
Just thought of the regshot while i was int eh bathroom lol.


NTDOCAdministrator
(KiX Master)
2005-08-11 02:12 AM
Re: Proper code to run command once

Quote:

Specifically, when you install the tool:

In the Group Policy, the tool enables DCOM for remote access permission to anonymous logon entry.
In the Windows firewall, the tool creates an exception for ummiddleman.exe, and opens TCP 135 port with the
appropriate scope for the MAS IP.





So should see those changes in the Registry


RonM
(Fresh Scripter)
2005-08-11 04:12 PM
Re: Proper code to run command once

I have no idea how to script any of those changes. Thats WAY over my head.

LonkeroAdministrator
(KiX Master Guru)
2005-08-11 04:29 PM
Re: Proper code to run command once

hmm... makes me wonder if there is some buggie boo in move/copy.

NTDOCAdministrator
(KiX Master)
2005-08-11 06:46 PM
Re: Proper code to run command once

We can help

Basically it looks like this application is saying it is adding some port exceptions to the Windows XP firewall.

Take a look here
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\GloballyOpenPorts\List

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List

Using RegShot on a system that HAS NOT been updated take the first snapshot. Then with RegShot still open, update one of the systems. Then take the 2nd snapshot, then review the differences.

Then with your script you read the registry and look for the change if it's there or not.