Logon script to install BigFix Agent

This works best as a computer policy start-up script GPO:

@echo off

REM
REM
REM Requirements:
REM		
REM Usage:	BigfixDeploy.bat [Optional Tagging Group] 
REM
REM To add:	
REM
REM
REM Name		Date	  Modification
REM ----------- 	-------   -------------------------------------------------------------
REM

REM Check to see if Bigfix is installed, if not intall it.

set BESINSTALLNAME=bfx.msi
set BESINSTALLNAMEPATH=%TMP%\%BESINSTALLNAME%
set BESNETWORKLOCATION=\\FQDN\NETLOGON\BFX\%BESINSTALLNAME%

REM if sc does not exist or is not in the path, this errorlevel check will deal with that.
sc query besclient | find /I "besclient" > nul
if %errorlevel% NEQ 1 goto check1

echo Bigfix client not found
echo Copying Bigfix client....
copy /Y %BESNETWORKLOCATION% %BESINSTALLNAMEPATH%
echo Installing Bigfix...
%BESINSTALLNAMEPATH% /qn /norestart
del %BESINSTALLNAMEPATH%

REM Check to see if command line parameter is passed, if so set as tagging group
REM if [%1] EQU [] goto confirminstall

if NOT EXIST %SYSTEMROOT%\bigfix md %SYSTEMROOT%\bigfix
REM echo %1 > %SYSTEMROOT%\bigfix\primarygroup.txt
if NOT EXIST %SYSTEMROOT%\bigfix\primarygroup.txt echo glo-win-clients> %SYSTEMROOT%\bigfix\primarygroup.txt

goto confirminstall

:confirminstall
sc query besclient | find /I "besclient" > nul
if %errorlevel% EQU 0 goto check1
echo Bigfix install failed

exit 1

goto check1

:check1
REM Check to make sure the agent service is set to automatically start, if not fix

echo Bigfix is installed

echo Checking Service Startup
sc qc besclient | find /I "auto_start" > nul
if %errorlevel% NEQ 1 goto check2
echo Setting Bigfix service to autostart
sc config besclient start= delayed-auto > nul

:check2
REM Check to make sure the agent service is running, if not fix

echo Checking Service State
sc query besclient | find /I "running" > nul
if %errorlevel% NEQ 1 goto end
echo Starting Bigfix service
sc start besclient > nul

:end
@echo on
exit
4 Likes