dfnkt Posted March 5, 2009 Share Posted March 5, 2009 I am looking on advice to writing a script in preferably Batch/CMD or VBS with PERL being an option. What I am trying to accomplish is either directly writing information obtained from a command line tool into some strings / keys into the registry.We are currently running CA Threat Manager 8.1 (AV and PestPatrol). From CA there is a command line tool called 'CompVer' that will output all the particular information related to signature version and AV base version. I either need to run this CompVer utility in a script and directly write 3 of the results into a registry key or write them out to a text file and import that into the registry.Here is the work I've done so far:>>>Run Compver and output to a text file<<<REM Run CompVer and output to a textfile@ECHO OFFcompver | Find "eTrust Antivirus Base" >> C:\ITM.txt && compver | Find "eTrust PestPatrol Signatures" >> C:\ITM.txt && compver | Find "eTrust Vet Engine" >> C:\ITM.txtEXIT>>>Write entries to the registry<<<@ECHO OFFREM Write to REG KeyREG ADD HKLM\SOFTWARE\ComputerAssociates\eTrustITM\StatusREG ADD HKLM\SOFTWARE\ComputerAssociates\eTrustITM\Status /v "eTrust AntiVirus Base" /t REG_MULTI_SZ I am looking for some way, hopefully in the same script to write the entries inside of C:\ITM.txt into the registry. I am assuming that this would use the FOR command however I have little experience with this command when writing batch. Like I said, VBS is an option but I haven't explored it yet as I am looking for something quick. Link to comment Share on other sites More sharing options...
dfnkt Posted March 5, 2009 Author Share Posted March 5, 2009 Here are my findings, his so far is working great. Alot of work for such a small script but it does its job. Revision 2 I guess would be a way to write directly to the registry without the need for text files. Not a bad attempt for never having used the FOR command.@ECHO OFFcd \SET VAR=eTrust Antivirus BaseSET VAR1=eTrust PestPatrol SignaturesSET VAR2=eTrust Vet EngineCompVer | Find "%VAR%" >> C:\ITM.txtCompVer | Find "%VAR1%" >> C:\ITM2.txtCompVer | Find "%VAR2%" >> C:\ITM3.txtREG ADD HKLM\SOFTWARE\ComputerAssociates\eTrustITM\StatusFOR /F "tokens=4 delims=, " %%i in (C:\ITM.txt) DO @REG ADD HKLM\SOFTWARE\ComputerAssociates\eTrustITM\Status /v "%VAR%" /d %%iFOR /F "tokens=4 delims=, " %%j in (C:\ITM2.txt) DO @REG ADD HKLM\SOFTWARE\ComputerAssociates\eTrustITM\Status /v "%VAR1%" /d %%jFOR /F "tokens=4 delims=, " %%k in (C:\ITM3.txt) DO @REG ADD HKLM\SOFTWARE\ComputerAssociates\eTrustITM\Status /v "%VAR2%" /d %%kDEL "C:\ITM.txt" && DEL "C:\ITM2.txt" && DEL "C:\ITM3.txt"EXIT Link to comment Share on other sites More sharing options...
jaclaz Posted March 5, 2009 Share Posted March 5, 2009 You shouldn't need the temporary .txt files. Does this output the wanted result?SET VAR=eTrust Antivirus BaseFOR /F "tokens=4 delims=, " %%i in ('CompVer ^| Find "%VAR%"') DO ECHO @REG ADD HKLM\SOFTWARE\ComputerAssociates\eTrustITM\Status /v "%VAR%" /d %%ijaclaz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now