I’ve finally started posting BigFix stuff to a github.
These bash and PowerShell scripts accept a file path (including wildcards), get the sizes and hashes for prefetch, and output the results in a visual table. I’ve found various other scripts that do this, but wanted use only native shell languages, and also format the output in a particular way.
Thanks for sharing @atlauren. Definitely useful to have OS native methods of getting this info.
Just as sharing another approach, for those using the FixletDebugger, here are 2 relevance templates I use to build a prefetch or prefetch block code with all the file details (just replace the URL and path to files with those suitable for your use case)
Q: ( "prefetch " & name of it & " sha1:" & sha1 of it & " size:" & size of it as string & " http://my.bes.sever.com:52311/Uploads" & concatenation "/" of substrings separated by "\" of (following text of first "\myfiles4bigfix" of (pathnames of it)) & " sha256:" & sha256 of it ) of files of folder "C:\TEMP\myfiles4bigfix"
A: prefetch setup.exe sha1:10e2e8457c17ba41b8a724189a0ca7ea80a1b065 size:272896 http://my.bes.sever.com:52311/Uploads/setup.exe sha256:2f48ce34d4e55e1ba000b891f2743c6be3961503ad920d6ceb665db19d24a460
A: prefetch setup.msi sha1:fbdccb5728aaaff26b350bd4e5174d0043322714 size:415232 http://my.bes.sever.com:52311/Uploads/setup.msi sha256:ad05ce0bf59324fb859aede3e9225957d0d4acaf4925ab4b68444d8afd7644a1
T: 13.579 ms
I: plural string
Q: ("add prefetch item name=" & name of it & " sha1=" & sha1 of it & " sha256=" & sha256 of it & " size=" & size of it as string & " url=http://my.bes.server.com:52311/Uploads" & concatenation "/" of substrings separated by "\" of (following text of first "\myfiles4bigfix" of (pathnames of it))) of files of folder "C:\TEMP\myfiles4bigfix"
A: add prefetch item name=setup.exe sha1=10e2e8457c17ba41b8a724189a0ca7ea80a1b065 sha256=2f48ce34d4e55e1ba000b891f2743c6be3961503ad920d6ceb665db19d24a460 size=272896 url=http://my.bes.server.com:52311/Uploads/setup.exe
A: add prefetch item name=setup.msi sha1=fbdccb5728aaaff26b350bd4e5174d0043322714 sha256=ad05ce0bf59324fb859aede3e9225957d0d4acaf4925ab4b68444d8afd7644a1 size=415232 url=http://my.bes.server.com:52311/Uploads/setup.msi
T: 7.230 ms
I: plural string
Thanks @SLB, I like your approach. Someday I might integrate “current pathname location” as an option, doing similar substitutions to magically derive the URL.
My main goals were:
accommodate the personal proclivity that sometimes I download while in this environment, sometimes in that other one.
format output in a way that is easily copy/pasted into our own property-laden actionscript templates.
use OS-native languages
I’ve been meaning to do this for a while, but finally got around to it after facing a particularly large list of files to churn through.