Page 1 of 1 1
Topic Options
#151767 - 2005-11-17 09:04 PM Read a value from the Registry, run a command from dos Could use help!!
rhamersley Offline
Fresh Scripter

Registered: 2005-11-09
Posts: 15
Loc: Fort Lauderdale, FL
WHat Im trying to accomplish is to verify that the version is 3.5 or less than if so then copy this executable file to the C:\Temp Directory. Then execute the FramePackage. But if this has the 3.5 version already installed on the computer then bypass the installation process and complete the script. Can anyone help me with this issue. The script below doesnt seem to work and from looking at it, it should???? Could use the help Thanks!!!


$ePOAgent=ReadValue('HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\EPOAGENT3000','Version')

? "Checking for ePOAgent Install"
If $ePOAgent<'3.5'

? "Downloading ePO Agent ver 3.5"
MD "c:\Temp"
Shell "%COMSPEC% /c c:\windows\system32\xcopy.exe " + @LSERVER+ "\netlogon\Utility\ePOAgent\FramePKG.exe C:\temp /e /y /d"

? "Installing ePO Agent ver 3.5"
Run "%COMSPEC% /c c:\temp\FramePkg.exe /Install=Agent /Silent"

? "Installation Completed."
Else
? "Current ePO Agent Version " + $ePOAgent + " already installed."
EndIf
EndIf

Top
#151768 - 2005-11-17 09:23 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Well, besides I’d change all single quotes to double quotes does it copy the files or not?
Are the shell and run statements correct? Why use xcopy? The copy build into kix will take out a dependency.

Put some error checking in the code using @error and @serror. It’s alot easier to see where the script fails with error checking in place.

[edit]
Oh...and please use code tags when posting code. The formating stays in place this way.
[/edit]


Edited by Mart (2005-11-17 09:24 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#151769 - 2005-11-17 09:27 PM Re: Read a value from the Registry, run a command from dos Could use help!!
rhamersley Offline
Fresh Scripter

Registered: 2005-11-09
Posts: 15
Loc: Fort Lauderdale, FL
What is the correct copy command in Kixtart
Top
#151770 - 2005-11-17 09:29 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Code:

COPY "S:\MyDir\*.*" "S:\NewDir\*.*"



This is the build in copy command in kix no need for exterbal apps and shell, run or whatever.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#151771 - 2005-11-17 09:29 PM Re: Read a value from the Registry, run a command from dos Could use help!!
rhamersley Offline
Fresh Scripter

Registered: 2005-11-09
Posts: 15
Loc: Fort Lauderdale, FL
The file does not copy down I receive an XCOPY error Failed to initialize properly. Does anyone know what is the correct copy command in KIXTART
Top
#151772 - 2005-11-17 09:39 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Well, besides I’d change all single quotes to double quotes...



Why?

KiX is perfectly happy with single quotes. Double quotes should be reserved for DOS and for strings with apostrophies.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#151773 - 2005-11-17 09:48 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Just a habit. Hard to get rid of.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#151774 - 2005-11-17 09:56 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Yes, habits are hard to get rid of. Still, you should not impose your habits on others. Feel free, however, to recommend your good habits!

Glenn

PS - As I've said elsewhere, I prefer single quotes for all Kix coding, and double quotes for DOS commands, which are often picky about their quoting requirements.
_________________________
Actually I am a Rocket Scientist! \:D

Top
#151775 - 2005-11-17 09:59 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:


....
Still, you should not impose your habits on others. Feel free, however, to recommend your good habits!
....





I know. That's why I said "I'd change...." and not "you should change....."
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#151776 - 2005-11-17 10:03 PM Re: Read a value from the Registry, run a command from dos Could use help!!
rhamersley Offline
Fresh Scripter

Registered: 2005-11-09
Posts: 15
Loc: Fort Lauderdale, FL
Could use the help emensly anyone. Lets break this down and let me know if this is correct.

If InGroup ("ALLKIXEPOINSTALL") -


$ePOAgent=ReadValue('HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\EPOAGENT3000','Version')


? "Checking for ePOAgent Install"
If $ePOAgent<'3.5'


? "Downloading ePO Agent ver 3.5"
MD "c:\Temp"
Shell "%COMSPEC% /c xcopy " + @LSERVER+ "\netlogon\Utility\ePOAgent\FramePKG.exe C:\temp /e /y /d"


? "Installing ePO Agent ver 3.5"
Run "%COMSPEC% /c c:\temp\FramePkg.exe /Install=Agent /Silent"
<5th run the FramePkg.exe file in a silent mode.>

? "Installation Completed."
Else
? "Current ePO Agent Version " + $ePOAgent + " already installed."
EndIf
EndIf

ALL I CAN SAY IT DOESNT WORK!!!!!

Top
#151777 - 2005-11-17 10:06 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Consider your statement: Code:
 If $ePOAgent<'3.5' 


You are forcing the 3.5 to be a string, not a numeric value, by placing it in quotes. I'd certainly get rid of THESE quotes!

Consider, also, that version strings can look like "X.Y.Z", which would be treated as a string. So, "3.4.8" could be "greater" than "3.5" because the string is longer, not because the value is higher. Checking version info can be a black art. You might want to use Split to return only the Major.Minor values, and then compare each of the elements in the array that Split returns. Just one idea of many possible solutions. The key is to know how your data is being represented, so you can compare it accurately.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#151778 - 2005-11-17 10:07 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
OK - while I'm reviewing it, I'm gonna echo the earlier sentiments - CODE TAGS!!!

G-
_________________________
Actually I am a Rocket Scientist! \:D

Top
#151779 - 2005-11-17 10:10 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
How about this?
Can't test cause I don't have EPO.

Code:

If InGroup ("ALLKIXEPOINSTALL")
$ePOAgent = ReadValue('HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\EPOAGENT3000','Version')
? "Checking for ePOAgent Install"
If $ePOAgent < 3.5
? "Downloading ePO Agent ver 3.5"
MD "c:\Temp"
Copy @LSERVER + "\netlogon\Utility\ePOAgent\FramePKG.exe" "c:\temp\" /s
? "Installing ePO Agent ver 3.5"
Run "c:\temp\FramePkg.exe /Install=Agent /Silent"
? "Installation Completed."
Else
? "Current ePO Agent Version " + $ePOAgent + " already installed."
EndIf
EndIf

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#151780 - 2005-11-17 10:21 PM Re: Read a value from the Registry, run a command from dos Could use help!!
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Same code, minor changes, added some debug statements (and used CODE TAGS)

I defined $Key just to keep the line length down.. makes it easier to read on the BB. Your original code was OK.

Glenn

Code:
$Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\EPOAGENT3000'

If InGroup ("ALLKIXEPOINSTALL") ; - <- What was this??


$ePOAgent = ReadValue($Key,'Version')


? "Checking for ePOAgent Install - current version string is " $ePOAgent ?

If Val($ePOAgent) < 3.5


"Downloading ePO Agent ver 3.5" ?
MD "c:\Temp"

$Cmd = "%COMSPEC% /c xcopy " + @LSERVER+ "\netlogon\Utility\ePOAgent\FramePKG.exe C:\temp /e /y /d"
'About to run ' $Cmd ? ; debug info - did you build your command properly?
Shell $Cmd
@SERROR ? ; did it succeed?


"Installing ePO Agent ver 3.5" ?
;Run "%COMSPEC% /c c:\temp\FramePkg.exe /Install=Agent /Silent"
Shell "%COMSPEC% /c c:\temp\FramePkg.exe /Install=Agent /Silent"

; What's this line?
; <5th run the FramePkg.exe file in a silent mode.>

; You say the install is complete, but a RUN can still be happening asynchronously...
; use Shell to invoke it synchronously. Also, test the @ERROR to see if it succeeded.

If @ERROR
? 'INSTALL FAIL: ' @SERROR ? ?
Else
"Installation Completed successfully." ?
EndIf

Else
"Current ePO Agent Version " + $ePOAgent + " already installed." ?
EndIf ; ePOAgent downlevel?

EndIf ; InGroup(ALLKIXEPOINSTALL)

_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.065 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

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