Configure BES Relay to Use Different Drive - Version >= 6.0
0 Votes |
Description
Note: Several DOS windows will appear while the BES Relay is configured. These DOS windows may remain in place for a short period of time while all the files in the relay cache are moved to their new location.
Note: Only the "wwwroot" BES Relay data folder will be moved, the BES Relay executable and other program files will remain at its current location.
Important Note: The first action will fail if the drive entered does not exist. The second action will fail if the new location of the BES Relay wwwroot folder is a subfolder of the current location. Both actions will fail if the new location of the BES Relay wwwroot folder already exists. Pathnames should not contain trailing backslashes or spaces.
Property Details
612 | |
Configure BES Relay to Use Different Drive - Version >= 6.0 | |
Optional | |
0 | |
BigFix | |
<Unspecified> | |
<Unspecified> | |
BES Relay Note location drive | |
besSupport on 10/17/2012 1:16:26 PM | |
danielheth on 10/17/2012 1:16:26 PM | |
6189 Views / 15 Downloads | |
![]() ![]() ![]() ![]() ![]() |
Relevance

version of client >= "6.0"

exists (values "value" of keys "HKLM\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath" of registry as folder)

exists relay service OR exists main gather service
Actions
Action 1
Action Link Click
here to configure the BES Relay to use a different drive. (The new location will be 'drive:\wwwroot')
Script Type
BigFix Action Script
action parameter query "RelayDrive" with description "Enter the drive of the new Relay location." with default "C:"
// The new Relay drive must exist.
continue if {exists drive (parameter "RelayDrive" of action)}
// The new location needs to be different from the current location.
continue if {(parameter "RelayDrive" of action) as lowercase & "\wwwroot" != (pathname of (values "value" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath" of registry as folder) as lowercase)}
delete __appendfile
delete __createfile
delete changedrive.reg
delete changedrive.bat
appendfile @ECHO OFF
appendfile net stop BESRelay
appendfile del "{value "ConfigLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry as string & "\*.bfg"}"
// empty out GatherState.xml
appendfile type NUL > "{value "InboxLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry as string & "\GatherState.xml"}"
parameter "ServerRootDir"="{value "value" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath" of registry}"
// if BES Relay v8.0 and above
if {exists relay service AND ((it >= "8.0") of (if (version of client >= "8.0") then (version of relay service) else (version of regapp "besrelay.exe")))}
appendfile rmdir /S /Q "{parameter "ServerRootDir"}bfmirror\bfsites"
appendfile mkdir "{parameter "ServerRootDir"}bfmirror\bfsites"
appendfile xcopy /E /Y /I /Q "{parameter "ServerRootDir"}*.*" "{parameter "RelayDrive" of action}\wwwrootbes"
appendfile rmdir /s /q "{parameter "ServerRootDir"}"
Createfile until end-reg-edit-commands
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath]
"value"="{escape of (parameter "RelayDrive" of action & "\wwwrootbes\")}"
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server]
"wwwRootFolder"="{escape of (parameter "RelayDrive" of action & "\wwwrootbes\")}"
end-reg-edit-commands
// else if older than BES Relay v8.0
else
appendfile rmdir /S /Q "{parameter "ServerRootDir"}\bfmirror\bfsites"
appendfile mkdir "{parameter "ServerRootDir"}\bfmirror\bfsites"
appendfile xcopy /E /Y /I /Q "{parameter "ServerRootDir"}\*.*" "{parameter "RelayDrive" of action}\wwwroot"
appendfile xcopy /E /Y /I /Q "{value "ContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\*.*" "{parameter "RelayDrive" of action}\wwwroot\bfmirror\bfsites"
appendfile xcopy /E /Y /I /Q "{value "DownloadContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\*.*" "{parameter "RelayDrive" of action}\wwwroot\bfmirror\downloads"
appendfile rmdir /s /q "{parameter "ServerRootDir"}"
appendfile rmdir /s /q "{value "ContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}"
appendfile rmdir /s /q "{value "DownloadContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}"
Createfile until end-reg-edit-commands
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath]
"value"="{escape of (parameter "RelayDrive" of action & "\wwwroot")}"
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService]
"ContentLocation"="{escape of (parameter "RelayDrive" of action & "\wwwroot\bfmirror\bfsites")}"
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService]
"DownloadContentLocation"="{escape of (parameter "RelayDrive" of action & "\wwwroot\bfmirror\downloads")}"
end-reg-edit-commands
endif
move __createfile changedrive.reg
appendfile regedit /s changedrive.reg
appendfile net start BESRelay
move __appendfile changedrive.bat
waithidden changedrive.bat
//wait 5 seconds
parameter "waitTime" = "{apparent registration server time}"
pause while {((apparent registration server time) - time (parameter "waitTime")) < 5*second}
// if for some reason the BES Relay hasn't started yet, fail here
continue if {exists running service "BESRelay"}
relay select
delete changedrive.reg
delete changedrive.bat
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.
Action 2
Action Link Click
here to configure the BES Relay to use a custom location.
Script Type
BigFix Action Script
action parameter query "RelayLocation" with description "Enter the full path without trailing backslashes or spaces to the new Relay location." with default "C:\Program Files\BigFix Enterprise\BES Relay\wwwroot"
// The new location pathname must not contain a tilde (i.e., it cannot be a shortened pathname, such as "C:\progra~1").
continue if {(parameter "RelayLocation" of action) does not contain "%7e"}
// The new location needs to be a new folder.
continue if {not exists folder (parameter "RelayLocation" of action)}
// The new location cannot be a subfolder of the current location.
continue if {((parameter "RelayLocation" of action) as lowercase does not contain (pathname of (values "value" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath" of registry as folder) as lowercase & "\"))}
delete __appendfile
delete __createfile
delete changedrive.reg
delete changedrive.bat
appendfile @ECHO OFF
appendfile net stop BESRelay
appendfile del "{value "ConfigLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry as string & "\*.bfg"}"
// empty out GatherState.xml
appendfile type NUL > "{value "InboxLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry as string & "\GatherState.xml"}"
parameter "ServerRootDir"="{value "value" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath" of registry}"
// if BES Relay v8.0 and above
if {exists relay service AND ((it >= "8.0") of (if (version of client >= "8.0") then (version of relay service) else (version of regapp "besrelay.exe")))}
appendfile rmdir /S /Q "{parameter "ServerRootDir"}bfmirror\bfsites"
appendfile mkdir "{parameter "ServerRootDir"}bfmirror\bfsites"
appendfile xcopy /E /Y /I /Q "{parameter "ServerRootDir"}*.*" "{parameter "RelayLocation" of action}"
appendfile rmdir /s /q "{parameter "ServerRootDir"}"
Createfile until end-reg-edit-commands
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath]
"value"="{escapes of (parameter "RelayLocation" of action & "\")}"
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server]
"wwwRootFolder"="{escapes of (parameter "RelayLocation" of action & "\")}"
end-reg-edit-commands
// else if older than BES Relay v8.0
else
appendfile rmdir /S /Q "{parameter "ServerRootDir"}\bfmirror\bfsites"
appendfile mkdir "{parameter "ServerRootDir"}\bfmirror\bfsites"
appendfile xcopy /E /Y /I /Q "{parameter "ServerRootDir"}\*.*" "{parameter "RelayLocation" of action}"
appendfile xcopy /E /Y /I /Q "{value "ContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\*.*" "{parameter "RelayLocation" of action}\bfmirror\bfsites"
appendfile xcopy /E /Y /I /Q "{value "DownloadContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}\*.*" "{parameter "RelayLocation" of action}\bfmirror\downloads"
appendfile rmdir /s /q "{parameter "ServerRootDir"}"
appendfile rmdir /s /q "{value "ContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}"
appendfile rmdir /s /q "{value "DownloadContentLocation" of key "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService" of registry}"
Createfile until end-reg-edit-commands
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\_BESRelay_HTTPServer_ServerRootPath]
"value"="{escapes of (parameter "RelayLocation" of action)}"
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService]
"ContentLocation"="{escapes of (parameter "RelayLocation" of action & "\bfmirror\bfsites")}"
[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\GatherService]
"DownloadContentLocation"="{escapes of (parameter "RelayLocation" of action & "\bfmirror\downloads")}"
end-reg-edit-commands
endif
move __createfile changedrive.reg
appendfile regedit /s changedrive.reg
appendfile net start BESRelay
move __appendfile changedrive.bat
waithidden changedrive.bat
//wait 5 seconds
parameter "waitTime" = "{apparent registration server time}"
pause while {((apparent registration server time) - time (parameter "waitTime")) < 5*second}
// if for some reason the BES Relay hasn't started yet, fail here
continue if {exists running service "BESRelay"}
relay select
delete changedrive.reg
delete changedrive.bat
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.
Sharing
Social Media: |