Full Cleanup of Old Sites on BES Relay
Log In or Register to download the BES file, and more.

2 Votes

Description

This task will rename the GatherState.xml and bfemapfile.xml files on the relay and delete the bfsites folder, then restart the BES Relay service to cleanup old sites and reinitialize the gather process. 

When attempting to use this task on all relays, run it first on the bottom tier of relays and work up to the server one tier at a time.

NOTE: This task should be deployed only at the direction of BigFix support.


Property Details

ID6256
StatusQA - Ready for Production Level Testing
TitleFull Cleanup of Old Sites on BES Relay
CategoryTroubleshooting
SourceBigFix
Source Release Date5/6/2009 12:00:00 AM
KeywordsRelay gather clean reset
Added by on 10/20/2015 9:54:24 PM
Last Modified by on 10/20/2015 9:58:16 PM
Counters 13986 Views / 214 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 0 ratings. ** Log In or Register to add your rating.

Relevance

Used in 2 fixlets   * Results in a true/false
Show indented relevance
exists regapp "besrelay.exe"

Actions

Action 1 (default)

Action Link Click  here  to deploy this action.
Script Type BigFix Action Script
// restart the BES Relay first
waithidden cmd.exe /C net stop besrelay

// set starting time
setting "_BESClient_PauseWhile"="{now as string}" on "{parameter "action issue date" of action}" for client

// PAUSE until the relay service stops or 3 minutes has passed.
pause while {(exists running application whose (name of it as lowercase = "besrelay.exe") OR exists running service whose (service name of it as lowercase = "besrelay")) AND (now - (value of setting "_BESClient_PauseWhile" of client as string as time)) < 3*minute}

delete "{value "InboxLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\GatherState.xml.bak"
move "{value "InboxLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\GatherState.xml" "{value "InboxLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\GatherState.xml.bak"
delete "{value "InboxLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\bfemapfile.xml.bak"
move "{value "InboxLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\bfemapfile.xml" "{value "InboxLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\bfemapfile.xml.bak"

waithidden cmd.exe /C rmdir "{value "ContentLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}" /S /Q

// set starting time
setting "_BESClient_PauseWhile"="{now as string}" on "{parameter "action issue date" of action}" for client

// PAUSE until the bfsites directory is gone or 5 minutes has passed.
pause while {(exists folder (value "ContentLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry as string)) AND (now - (value of setting "_BESClient_PauseWhile" of client as string as time)) < 5*minute}

waithidden cmd.exe /C mkdir "{value "ContentLocation" of key "HKLM\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry as string}"

waithidden cmd.exe /C net start besrelay

// if for some reason the BES Relay hasn't started yet, fail here
continue if{exists running service "BESRelay"}

// then restart the BES Client
delete __appendfile
appendfile @echo off
appendfile echo Your administrator is restarting the BES Client... Please Wait...
appendfile net stop BESClient
appendfile net start BESClient

delete clientRestart.bat
copy __appendfile clientRestart.bat
runhidden cmd.exe /C clientRestart.bat
Success Criteria

This action will be considered successful when the applicability relevance evaluates to false.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!
shlomi -
isn't the success criteria wrong? the applicability is "is the machine a relay", and the success criteria considers successful when the applicability is false, but the task does not remove the relay, hence it will always fail... IMHO, it should be "all lines completed successfully"