Run softwareupdate (Mac)
Log In or Register to download the BES file, and more.

0 Votes

Description

This action runs softwareupdate on target macOS machine. Supplied username and password _must_ be for a user with a secure token.

If supplied account does not have a secure token, fixlet will exit with exit code 30.


Property Details

ID27345
StatusQA - Ready for Production Level Testing
TitleRun softwareupdate (Mac)
DomainBESC
SourceInternal
Source Release Date5/14/2024 12:00:00 AM
Keywordsmacos, softwareupdate, upgrade, update, secure parameter
Added by on 6/3/2024 1:36:02 PM
Last Modified by on 6/3/2024 1:36:02 PM
Counters 241 Views / 3 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 226 fixlets and 100 analyses   * Results in a true/false
Show indented relevance
mac of operating system

Actions

Action 1 (default)

Action Link Click here to deploy this action.
Script Type BigFix Action Script
parameter "mainSWDLogFolder" = "{parent folder of client folder of current site}/__Global/SWDDeployData"
folder create "{parameter "mainSWDLogFolder"}"
parameter "logFile" = "SWD_DeploymentResults.log"

parameter "scriptName" = "LostChapter.sh"

wait sh -c "echo '' >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'"
wait sh -c "echo $(date +%Y_%m_%d' '%T) >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'"
wait sh -c "echo Action ID: {id of active action} >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'"

parameter "updateCommand" = "softwareupdate {parameter "commands"} {parameter "subcommands"} {parameter "restart"} {parameter "scan"} --user {parameter "adminUser"} --stdinpass --agree-to-license --force"

delete __createfile
delete "__Download/{parameter "scriptName"}"
createfile until _end_
#!/bin/zsh
echo "Running: {parameter "updateCommand"}" >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'
adminUser="{parameter "adminUser" of action}"
precheck=$(sysadminctl -secureTokenStatus $adminUser 2>&1)
if [[ "$precheck" == *"ENABLED"* ]]; then
echo "Provided user $adminUser has a secure token. Continuing..." >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'
        exit 0
elif [[ "$precheck" == *"DISABLED"* ]]; then
echo "Provided user $adminUser does not have a secure token" >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'
exit 30
else
echo "Error checking $adminUser secure token status" >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'
exit 31
fi
_end_
copy "__createfile" "__Download/{parameter "scriptName"}"
wait chmod +x "__Download/{parameter "scriptName"}"
wait /bin/zsh "__Download/{parameter "scriptName"}"
parameter "error" = "{exit code of action}"
delete __createfile
delete "__Download/{parameter "scriptName"}"

if {parameter "error" is "0"}
run bash -c "echo '{parameter "adminUserPassword"}' | {parameter "updateCommand"} 2>&1 | awk '!/Downloading:/{{print}' >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'"
parameter "error2" = "{exit code of action}"
wait sh -c "echo Return Code: {parameter "error2"} >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'"
endif

if {parameter "error" != "0"}
wait sh -c "echo Return Code: {parameter "error"} >> '{parameter "mainSWDLogFolder"}/{parameter "logFile"}'"
exit {parameter "error"}
endif

exit {parameter "error2"}
Success Criteria

This action will be considered successful when all lines of the action script have completed successfully.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!