Logon script to install BigFix Agent

Hi all,

I referred to the this link http://www-01.ibm.com/support/docview.wss?uid=swg21505825
I change it to the following, from the scripting, checking is fine, but the issue is if I run this scripting without run as administrator, installation will not start, in turn of if I run this scripting as administrator, installation will go on.
Anyone can share experience on logon script to install Bigfix agnet? thanks a lot.

Logon script:

@echo off
set SERVERNAME=PC1
set SHARENAME=bigfix
if exist "C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClient.exe" goto agentinstalled
if exist "C:\Program Files\BigFix Enterprise\BES Client\BESClient.exe" goto agentinstalled
if not exist "C:\Program Files\BigFix Enterprise\BES Client\BESClient.exe" goto installation

:agentinstalled
echo "Agent already installed"
exit()

:installation
echo Agent now going to be installed
xcopy /s /y /i \\%SERVERNAME%\%SHARENAME%\BigFixAgent.msi C:\TEMP\Bigfix\
xcopy /s /y /i \\%SERVERNAME%\%SHARENAME%\1033.mst C:\TEMP\Bigfix\
xcopy /s /y /i \\%SERVERNAME%\%SHARENAME%\clientsettings.cfg C:\TEMP\Bigfix\
xcopy /s /y /i \\%SERVERNAME%\%SHARENAME%\masthead.afxm C:\TEMP\Bigfix\
start /wait msiexec /i "C:\TEMP\Bigfix\BigFixAgent.msi" /T="1033.mst" /qn

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

I like this, much more complete. Definitely something I should think about adding to my installation scripts.

I’m not sure if powershell works well as a start-up script, but if so, you could use this:

It might be possible to do the downloads without PowerShell as well, but I didn’t investigate that. The idea is all a computer needs to get going is to know a relay it can reach to grab the masthead.afxm from and an internet connection to get the client installer. It would be possible to make the baseurl configurable and host the client installers on your own server.

Related: tools/bash/install_bigfix.sh at master · jgstew/tools · GitHub

1 Like

Hi Alexa,

Thanks for your kindly sharing.

1 Like

Hi jgstew,

Thanks for your sharing

1 Like

You have:

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

and then

copy /Y %BESNETWORKLOCATION% %BESINSTALLNAMEPATH%

so it copies everything to a destination name bfx.msi

Just copy to %tmp% and it should be OK

Thanks. I later discovered that. :yum:

I just tested this, and it did work as a start up script, just added the check for the BigFix service: tools/CMD/install_bigfix.bat at master · jgstew/tools · GitHub

Note: @AlexaVonTess 's example tests a lot more things than mine.

Just specify the FQDN of the desired relay for devices to connect to as the only parameter. Ideally this would be a relay that any domain joined computer could reach.

Related: