Help with a basic prefetch command

Hello everyone.

I am trying to copy a file called AXConfig.axc to c:\temp but it’s not working.

I created a folder named with the sha1 along with the file inside the folder to:
\BES Server\wwwrootbes\Uploads\f2d20dde132d1fa4efc004ded9f77b9ddf1085ef\AXConfig.axc

I uploaded the the sha1 renamed file AXConfig.axc to:
BES Server\wwwrootbes\bfmirror\downloads\sha1\f2d20dde132d1fa4efc004ded9f77b9ddf1085ef

Here’s my action script

// prefetch downloads a besarchive of the image and checks its sha values
prefetch f2d20dde132d1fa4efc004ded9f77b9ddf1085ef sha1:f2d20dde132d1fa4efc004ded9f77b9ddf1085ef size:163840 http://127.0.0.1:52311/uploads/f2d20dde132d1fa4efc004ded9f77b9ddf1085ef/AXConfig.axc sha256:282ef8a525742853c7d237466b4c6480957f756b6ab71a259b76d10550537d5e
						 
// the extract command extracts the besarchive to the __Download folders.
extract f2d20dde132d1fa4efc004ded9f77b9ddf1085ef

// creates c:\temp if it doesn't exist
folder create "C:\Temp"

// copies the file from download to the temp folder
copy "__Download/AXConfig.axc" "C:\Temp\AXConfig.axc" 

// extract the file to c:\temp in the first place, bypassing __Download/
extract f2d20dde132d1fa4efc004ded9f77b9ddf1085ef C:\Temp

I am following this BigFix Tech Advisors YT video which seems pretty straight forward but misses the intricacies of where to place the files :man_shrugging:

And this is what the logs on the workstation look like:

At 14:12:21 -0500 - mailboxsite (http://besroot.domain.local:52311/cgi-bin/bfgather.exe/mailboxsite1620321029)
   Relevant - Custom Action (fixlet:173569)
At 14:12:21 -0500 - 
   ActionLogMessage: (action:173569) Action signature verified for Downloads
   DownloadsAvailable: checking for 'http://relay.domain.local:52311/bfmirror/downloads/173569/0'
   DownloadsAvailable: false (action id 173569)
At 14:12:37 -0500 - 
   Report posted successfully
   DownloadPing command received (ID=173569)
   DownloadsAvailable: checking for 'http://relay.domain.local:52311/bfmirror/downloads/173569/0'
   DownloadsAvailable: true (action id 173569)
   DownloadsAvailable: checking for 'http://relay.domain.local:52311/bfmirror/downloads/173569/0'
   DownloadsAvailable: true (action id 173569)
   ActionLogMessage: (action:173569) Non-Distributed - DownloadsAvailable
   ActionLogMessage: (action:173569) Submitting download request
   ActionLogMessage: (action:173569) Download url: 'http://127.0.0.1:52311/uploads/f2d20dde132d1fa4efc004ded9f77b9ddf1085ef/AXConfig.axc'
At 14:13:00 -0500 - 
   DownloadsAvailable: checking for 'http://relay.domain.local:52311/bfmirror/downloads/173569/0'
   DownloadsAvailable: true (action id 173569)
   ActionLogMessage: (action:173569) Non-Distributed - DownloadsAvailable
   ActionLogMessage: (action:173569) Submitting download request
   ActionLogMessage: (action:173569) Download url: 'http://127.0.0.1:52311/uploads/f2d20dde132d1fa4efc004ded9f77b9ddf1085ef/AXConfig.axc'
At 14:15:00 -0500 - 
   DownloadsAvailable: checking for 'http://relay.domain.local:52311/bfmirror/downloads/173569/0'
   DownloadsAvailable: true (action id 173569)
   ActionLogMessage: (action:173569) Non-Distributed - DownloadsAvailable
   ActionLogMessage: (action:173569) Submitting download request
   ActionLogMessage: (action:173569) Download url: 'http://127.0.0.1:52311/uploads/f2d20dde132d1fa4efc004ded9f77b9ddf1085ef/AXConfig.axc'
At 14:15:25 -0500 - 
   Successful Synchronization with site 'BES Asset Discovery' (version 109) - 'http://sync.bigfix.com/cgi-bin/bfgather/assetdiscovery'
   Successful Synchronization with site 'BES Inventory and License' (version 200) - 'http://sync.bigfix.com/cgi-bin/bfgather/besinventory'
At 14:15:26 -0500 - 
   Successful Synchronization with site 'BigFix Labs' (version 55) - 'http://sync.bigfix.com/cgi-bin/bfgather/bigfixlabs'
At 14:15:28 -0500 - 
   Successful Synchronization with site 'Client Manager for TPMfOSD' (version 11) - 'http://sync.bigfix.com/cgi-bin/bfgather/clientmanagerfortpmfosd'
At 14:15:29 -0500 - 
   Successful Synchronization with site 'CustomSite_Desktop_Support' (version 30944) - 'http://besroot.domain.local:52311/cgi-bin/bfgather.exe/CustomSite_Desktop_Support'
At 14:15:31 -0500 - 
   Successful Synchronization with site 'CustomSite_Windows_Workstations_CheckList' (version 84599) - 'http://besroot.domain.local:52311/cgi-bin/bfgather.exe/CustomSite_Windows_Workstations_CheckList'
At 14:16:10 -0500 - 
   GatherHashMV command received.
At 14:16:11 -0500 - mailboxsite (http://besroot.domain.local:52311/cgi-bin/bfgather.exe/mailboxsite1620321029)
   Gather::SyncSiteByFile deleting files - count: 1
At 14:16:11 -0500 - 
   Successful Synchronization with site 'mailboxsite' (version 104) - 'http://besroot.domain.local:52311/cgi-bin/bfgather.exe/mailboxsite1620321029'
   Processing action site.
At 14:17:17 -0500 - 
   Report posted successfully

From what I can tell it tries to download multiple sites until I just stop the action.

Also when entering the file size in bytes, which number do I use? Size or Size on disk?:

image

Thanks everyone!

I got it after much scratching my head…

// prefetch downloads a besarchive of the image and checks its sha values
prefetch f2d20dde132d1fa4efc004ded9f77b9ddf1085ef sha1:f2d20dde132d1fa4efc004ded9f77b9ddf1085ef size:163346 http://127.0.0.1:52311/Uploads/f2d20dde132d1fa4efc004ded9f77b9ddf1085ef/AXConfig.axc.bfswd sha256:282ef8a525742853c7d237466b4c6480957f756b6ab71a259b76d10550537d5e

// the extract command extracts the besarchive to the __Download folders.
// extract f2d20dde132d1fa4efc004ded9f77b9ddf1085ef

// creates c:\temp if it doesn’t exist
folder create “C:\Temp”

// copies the file from download to the temp folder
copy “__Download/f2d20dde132d1fa4efc004ded9f77b9ddf1085ef” “C:\Temp\AXConfig.axc”

and I compared another fixlet prefetch command and the bytes size to use from the file properties is the Size and NOT Size on disk :+1:

Just one additional Q, do I need to place this file in both the Uploads\ and sha1\ ?

Thanks!

edit: and just learned the need to add a delete so you dont get the file already exists error on the logs

delete “C:\Temp\AXConfig.axc”

is there an override opcion for the copy command? I didn’t find any info on it.

The file only needs to be in a subdirectory of the Uploads folder. I believe your root issue is that web URL filenames are case-sensitive, and you were using “uploads” rather than “Uploads”.

In fact this is treated like a download from any other website - you don’t even need to copy it onto your root server, if you have the file available on a web server somewhere else.

Usually we would just always do a delete before a copy; if the file does not exist, the ‘delete’ command simply moves on.

1 Like

Hi @JasonW I made multiple changes trying each action, I did change the upload to Upload but by problem was on the copy command. I was using the name of the file itself instead of the files sha1 value. It was trying to copy a file that didn’t exist since it sits on __Download with the sha1 name.

This worked:

//deletes axconfig.axc if already exists
delete “C:\Temp\AXConfig.axc”

// copies the file from download to the temp folder
copy “__Download/f2d20dde132d1fa4efc004ded9f77b9ddf1085ef” “C:\Temp\AXConfig.axc”

That’s how you pull downloads and patches for windows :slight_smile: