BigFix Shortcuts and Cheat Sheets

We all have our BigFix shortcuts and cheat sheets for things but what are some of the most common things you’ve got saved in that notepad to just copy and paste and save yourself time typing?

For me, the one I love and use the most is:

tail -f /var/opt/BESClient/__BESData/__Global/Logs/$(date +%Y%m%d).log

The time this has probably saved me is absolutely mental :smiley:

Others that I have saved are:

// Adding a wait
parameter “startTime”="{now}"
pause while { (now-time(parameter “startTime”) < 180*second) }

// Use the client properties 
if {value of setting "x" of client as string = "x" or value of setting "x" of client as string = "y"} 

// Short for client folder 
"{​(client folder of current site as string) & "/__Download/x.xxx"}​" 

// Pre-Fetch Block 
begin prefetch block 
add prefetch item name= sha1= size= url=http://x.com:52311/Uploads/ sha256= 
collect prefetch items 
end prefetch block 

Then there’s this one that causes me headaches as there are too many ways to do it…

//execute ps1 regardless of version
if {exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry}
waithidden {pathname of file ((it as string) of value "Path" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry)} -executionpolicy remotesigned -File "{pathname of client folder of current site & "\__Download\x.ps1"}"
else if {not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry}
waithidden cmd.exe /c powershell.exe -executionpolicy remotesigned -File "{pathname of client folder of current site & "\__Download\x.ps1"}"
endif
3 Likes

Great tips, thanks for sharing John.

I use AutoHotKey (a Windows application) to assign shortcuts and take cheating to the next level. Whenever I type beslog and press space it will automatically expand to tail -f /var/opt/BESClient/__BESData/__Global/Logs/date +%Y%m%d.log

In case anyone else uses it, of would like to try it, https://www.autohotkey.com/. The AHK script code I use is

::beslog::
SendInput tail -f /var/opt/BESClient/__BESData/__Global/Logs/``date {+}`%Y`%m`%d``.log
return
3 Likes

In my .zprofile:
alias qna="sudo /Library/BESAgent/BESAgent.app/Contents/MacOS/QnA -t -showtypes"

(and similar for other shells and other qna locations on other platforms)

3 Likes

Functionally similar PowerShell and shell scripts for getting files’ hashes and sizes for pasting into a prefetch:

3 Likes

Latest n lines of the client’s current log file (example uses 100). Very useful in remote QNA:

locked rawlines (integers in ((number of locked rawlines of it - 100),(number of locked rawlines of it))) of (file ((current year as string) & (current month as two digits) & (current day_of_month as two digits) & ".log") of folder "Logs" of folder "__Global" of data folder of client)
5 Likes