Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Batch File That Checks The Registary

- - - - - Batch File McAfee

  • Please log in to reply
2 replies to this topic

#1
Vespian

Vespian
  • Member
  • 1 posts
  • Joined Yesterday, 01:24 AM
  • OS:Windows 7 x64
  • Country: Country Flag

Hi, I am hoping someone can help. I am currently writing a batch file that checks for a version of software in the registry then if the right version checks the server entry in the registry. I've managed to get the version of software part working thanks to this topic http://www.msfn.org/...on-in-registry/ and Wise Owl's advice in it but have become stuck.
 
This is my script so far
 

Set "key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1FDB8EC6-BAF1-42F9-8E09-4D9AB369F1B5}"

Reg query %key% /v DisplayVersion|Find "4.8.0.887">Nul&&(

Goto ServerCheck)

"framepkg.exe" /Install=Agent /Silent

:ServerCheck

Set "key=HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent"

Goto Stop)

"framepkg.exe" /Install=Agent /Silent

:Stop

Pause

The output from Set "key=HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent" is below. The part I'm looking to check is the ePOServerList    REG_SZ and if CMCSU-EPO-01.cict.local is in the entry and if so go to Stop.
 

Agent
    EnableVDIMode    REG_SZ    0
    Installed Path    REG_SZ    C:\Program Files\McAfee\Common Framework
    binsphash    REG_SZ    B7BB45E1B73318C7F725E0A385C1DCC9D215FFE4D9CD3FDBB502DFE3CDD12EDC
    LoggedOnUser    REG_SZ    wg_tech
    (Default)    REG_SZ
    SMBiosUUID    REG_SZ    00BC3E8C-6FB7-E111-8025-B05963090386
    AgentGUID    REG_SZ    {AFC66908-0D2D-452D-B08A-650A52F6CFC6}
    AgentWakeUpPort    REG_SZ    8081
    IPAddress    REG_SZ    192.168.16.99
    SubnetAddress    REG_SZ    192.168.16.0
    SubnetMask    REG_SZ    255.255.255.0
    MacAddress    REG_SZ    e8e0b70cc45e
    ComputerName    REG_SZ    Y0185APH
    LastASCTime    REG_DWORD    0x55642428
    IPHostName    REG_SZ    Y0185APH.CWN
    PropsVersion    REG_SZ    20150526074336
    SequenceNumber    REG_DWORD    0x2
    ePOServerList    REG_SZ    CMCSU-EPO-01.cict.local|10.221.195.103|447;MDGH-EPO-AHN3.cict.local|10.221.195.102|447
    LastPolicyUpdateTime    REG_DWORD    0x55642428
    LastPropsVersion    REG_SZ    20150526074336
    McTrayAllowUpdate    REG_SZ    0

Edited by Yzöwl, Today, 04:48 AM.
Added code boxes.



How to remove advertisement from MSFN

#2
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,677 posts
  • Joined 02-August 04
  • OS:Windows 7 x64
  • Country: Country Flag

Welcome Vespian,

Here is something that may help. It is just the part that you requested help with.

@echo off
setlocal enabledelayedexpansion

rem Ensure regData is undefined now so it can be tested later if it has been defined.
set "regData="

rem Token 2 is %%A, which is expected to be REG_SZ. Used only to get to token *, which is %%B, which is all of the data value.
for /f "tokens=2*" %%A in (
 'reg query "HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent" /v ePOServerList'
) do set "regData=%%~B"

rem If regData is not defined, then seems no good continuing?
if not defined regData goto :stop

rem Show the value of regData. Use delayed expansion as you can expect pipe characters in the string.
echo regData=!regData!

rem If substitution fails, then equality is true.
if "!regData:CMCSU-EPO-01.cict.local=!" == "!regData!" goto :stop

rem You only want to install framepkg.exe once. Need a flag variable to decide this i.e. if not %installed% ...
"framepkg.exe" /Install=Agent /Silent

:stop

pause

endlocal
goto :eof

As mentioned in a comment, you only want to install framepkg.exe once so create a variable to use as a flag. Once the script installs framepkg.exe, then set the flag variable to a value i.e. 1. The you can test the variable later for value of 1 and not install if true. Use an initial value i.e. 0.

 



#3
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,073 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

I have a couple of observations with your 'uninstall entry' check.

 

There is no need to check the DisplayVersion, merely the existence of the key; because {1FDB8EC6-BAF1-42F9-8E09-4D9AB369F1B5} is pertinent only to the DisplayVersion 4.8.0.887 (i.e. McAfee Agent 4.8 Patch 1).

 

However are you sure you're only wanting to check for that specific version?

 

what about McAfee Agent 4.8:

  • key {11FEE8E5-D9BD-4AC1-8074-5169069DF812}; DisplayVersion 4.8.0.641

and McAfee Agent 4.8 Patch 2?

  • key {EBF3D65F-011E-44D2-8F4F-C74B52682EDD}; DisplayVersion 4.8.0.1500

Also don't forget that persons using a 64bit OS will have that uninstall key in a different location







Also tagged with one or more of these keywords: Batch File, McAfee

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users