This task will create BIOS update tasks in the same site as this task is run from using the current console operator username and password and the REST API. This task uses secure parameters so the password is encrypted.
NOTE: The password will be visible when typed into the prompt, which is due to a JavaScript limitation.
/* Only if there is a BIOS update in the Dell Command Update results */exists node values whose ( itas trimmed string as lowercase startswith"downloads.dell.com" ) of child nodes of child nodes whose ( node name ofit="file" ) of parent nodes of parent nodes of xpaths "/updates/update/type/text()"whose ( node value ofitas trimmed string as uppercase ="BIOS" ) of xml documents of files "results_DellUpdate.xml"of folders "__BESData\__Global\Logs"of parent folder of client
/* Only if there is a BIOS update in the Dell Command Update results */exists node values whose(itas trimmed string as lowercase startswith"downloads.dell.com") of child nodes of child nodes whose(node name ofit="file") of parent nodes of parent nodes of xpaths "/updates/update/type/text()"whose(node value ofitas trimmed string as uppercase ="BIOS") of xml documents of files "results_DellUpdate.xml"of folders "__BESData\__Global\Logs"of parent folder of client
/* Only if the update is the same or newer than the current BIOS version */exists ( node values of child nodes of child nodes whose ( node name ofit="version" ) of parent nodes of parent nodes of xpaths "/updates/update/type/text()"whose ( node value ofitas trimmed string as uppercase ="BIOS" ) of xml documents of files "results_DellUpdate.xml"of folders "__BESData\__Global\Logs"of parent folder of client ) whose ( itas string as trimmed string as version >= ( ( itas string as trimmed string as version ) of value "bios_version"of structures "bios_information"of smbios ) )
/* Only if the update is the same or newer than the current BIOS version */exists (node values of child nodes of child nodes whose(node name ofit="version") of parent nodes of parent nodes of xpaths "/updates/update/type/text()"whose(node value ofitas trimmed string as uppercase ="BIOS") of xml documents of files "results_DellUpdate.xml"of folders "__BESData\__Global\Logs"of parent folder of client) whose(itas string as trimmed string as version >= ( (itas string as trimmed string as version) of value "bios_version"of structures "bios_information"of smbios ) )
/* Only if the task has not been run in the past 7 days */ ( notexists files whose ( name ofitstartswith"RESTAPI_ImportedTasksDellBIOS_"AND name ofitas lowercase ends with".log"AND ( now - modification time ofit < 7*day ) ) of folder "__BESData\__Global\Logs"of parent folder of client )
/* Only if the task has not been run in the past 7 days */ (notexists files whose(name ofitstartswith"RESTAPI_ImportedTasksDellBIOS_"AND name ofitas lowercase ends with".log"AND (now - modification time ofit < 7*day) ) of folder "__BESData\__Global\Logs"of parent folder of client)
/* if this relevance is updated using the session relevance referenced, then only computers that do not already have a BIOS update task available will be relevant */notexists ( it ) whose ( ( itas trimmed string startswith"Update: Dell BIOS - Model:'" ) AND ( ( preceding text of first "' - "of following text of first "' Version:'"ofit ) = ( ( itas string as trimmed string ) of node value of child nodes of child nodes whose ( node name ofit="version" ) of parent nodes of parent nodes of xpaths "/updates/update/type/text()"whose ( node value ofitas trimmed string as uppercase ="BIOS" ) of xml documents of files "results_DellUpdate.xml"of folders "__BESData\__Global\Logs"of parent folder of client ) ) AND ( ( preceding text of first "' Version:'"of following text of first "Update: Dell BIOS - Model:'"ofit ) = ( ( value "product_name"of structures "system_information"of smbios ) as string as trimmed string ) ) ) of/* The following should be periodically replaced with the output of the session relevance found here: http://bigfix.me/relevance/details/2999468 */ ( "";"" )
/* if this relevance is updated using the session relevance referenced, then only computers that do not already have a BIOS update task available will be relevant */notexists (it) whose( (itas trimmed string startswith"Update: Dell BIOS - Model:'") AND ( (preceding text of first "' - "of following text of first "' Version:'"ofit) = ( (itas string as trimmed string) of node value of child nodes of child nodes whose(node name ofit="version") of parent nodes of parent nodes of xpaths "/updates/update/type/text()"whose(node value ofitas trimmed string as uppercase ="BIOS") of xml documents of files "results_DellUpdate.xml"of folders "__BESData\__Global\Logs"of parent folder of client ) ) AND ( (preceding text of first "' Version:'"of following text of first "Update: Dell BIOS - Model:'"ofit)=( (value "product_name"of structures "system_information"of smbios) as string as trimmed string ) ) ) of/* The following should be periodically replaced with the output of the session relevance found here: http://bigfix.me/relevance/details/2999468 */ ( "";"" )
// DEBUGGING: The following is for debugging // appendfile {parameter "RootServerURL"} // appendfile {parameter "currentSiteName"} // appendfile {parameter "currentSiteType"} // appendfile {parameter "currentConsoleUser"} // move __appendfile __Download\parameters.txt // parameter "secret" of action
// -- START:DOWNLOADS -------------------------
// - This is the commandline 7zip console which is use to unpack installers // - https://www.virustotal.com/en/file/2a3afe19c180f8373fa02ff00254d5394fec0349f5804e0ad2f6067854ff28ac/analysis prefetch 7za.zip sha1:9ce9ce89ebc070fea5d679936f21f9dde25faae0 size:384846 http://softlayer-dal.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip
// - This unzip is a compiled verion of unzip v5.52 fom http://info-zip.org/ // - https://www.virustotal.com/en/file/8d9b5190aace52a1db1ac73a65ee9999c329157c8e88f61a772433323d6b7a4a/analysis prefetch unzip.exe sha1:e1652b058195db3f5f754b7ab430652ae04a50b8 size:167936 http://software.bigfix.com/download/redist/unzip-5.52.exe
// Download CURL http://curl.haxx.se/download.html // - Analysis of the CURL.exe inside: https://www.virustotal.com/en/file/7e4379dc72cc25e8d546b3f4b4305b93b6521aaae47c1ea2ee49e4cc4ce8b033/analysis/ prefetch curl.cab sha1:3edb8cfb34ba149ca36b2540cf58a50430a3c8bc size:432989 http://home.arcor.de/skanthak/download/curl-7.38.0.cab
// EXTRACT using unzip: the 7zip command line utility waithidden __Download\unzip.exe -o "{pathname of file "7za.zip" of folder "__Download" of client folder of current site}" 7za.exe -d "{pathname of folder "__Download" of client folder of current site}"
// EXTRACT using 7zip: CURL waithidden"{ (pathname of file "7za.exe" of folder "__Download" of client folder of current site) }" e -i!Curl.EXE -y -o"{pathname of folder "__Download" of client folder of current site}" "{pathname of file "curl.cab" of folder "__Download" of client folder of current site}"
// VERIFY: Make sure the parameters are set continueif{ (parameter "currentSiteName" as trimmed string != "") AND (parameter "currentSiteType" as trimmed string != "") AND (parameter "RootServerURL" as trimmed string != "") }
// DELETE: the tasks output of current site in case it exists already delete"{pathname of folder "__Download" of client folder of current site}\Tasks_{parameter "currentSiteName"}.xml"
// REST API: Get names of all tasks in current site waithidden"{ (pathname of file "Curl.EXE" of folder "__Download" of client folder of current site) }" -k -o "{pathname of folder "__Download" of client folder of current site}\Tasks_{parameter "currentSiteName"}.xml" --user {parameter "currentConsoleUser"}:{parameter "secret"} https://{parameter "RootServerURL"}/api/tasks/{parameter "currentSiteType"}/{parameter "currentSiteName"}
// VERIFY: Make sure the same version bios update task does not already exist for the same model of machine continueif{ not exists node values whose( (it as trimmed string starts with "Update: Dell BIOS - Model:'") AND ( (preceding text of first "' - " of following text of first "' Version:'" of it) = ( (it as string as trimmed string) of node value of child nodes of child nodes whose(node name of it = "version") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client ) ) AND ( (preceding text of first "' Version:'" of following text of first "Update: Dell BIOS - Model:'" of it)=( (value "product_name" of structures "system_information" of smbios) as string as trimmed string ) ) ) of xpaths "/BESAPI/Task/Name/text()" of xml documents of files ( "Tasks_" & (parameter "currentSiteName") & ".xml" ) of folders "__Download" of client folder of current site } // not exists node values whose( (it as trimmed string starts with "Update: Dell BIOS - Model:'") AND ( (preceding text of first "' - " of following text of first "' Version:'" of it) = ( (it as string as trimmed string) of node value of child nodes of child nodes whose(node name of it = "version") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client ) ) AND ( (preceding text of first "' Version:'" of following text of first "Update: Dell BIOS - Model:'" of it)=( (value "product_name" of structures "system_information" of smbios) as string as trimmed string ) ) ) of xpaths "/BESAPI/Task/Name/text()" of xml documents of files ( "Tasks_" & (parameter "currentSiteName") & ".xml" ) of folders "__Download" of client folder of current site
// DOWNLOAD: BIOS Update using CURL waithidden"{ (pathname of file "Curl.EXE" of folder "__Download" of client folder of current site) }" -k -o "{pathname of folder "__Download" of client folder of current site}\BIOS_Update.exe"{ "https://" & unique value of node values whose(it as trimmed string as lowercase starts with "downloads.dell.com") of child nodes of child nodes whose(node name of it = "file") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client }
// VERIFY: size of download = size reported by dell command update continueif{ (size of file "BIOS_Update.exe" of folder "__Download" of client folder of current site) = ( (it as trimmed string as integer) of unique value of node values of child nodes of child nodes whose(node name of it = "bytes") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client ) }
// CREATEFILE createfileuntil END_OF_FILE ="1.0" encoding="UTF-8"?> ="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd"> Update: Dell BIOS - Model:'{ (value "product_name" of structures "system_information" of smbios) as string as trimmed string }' Version:'{ (it as string as trimmed string) of node value of child nodes of child nodes whose(node name of it = "version") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client }' - Windows { (value "product_name" of structures "system_information" of smbios) as string as trimmed string } BIOS to version: { (it as string as trimmed string) of node value of child nodes of child nodes whose(node name of it = "version") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client } ]]> /* Windows Only */ windows of operating system ="5.1"]]> /* DELL Only */ exists values "vendor" whose(it as string as uppercase contains "DELL") of structures "bios_information" of smbios ("{ (value "product_name" of structures "system_information" of smbios) as string as trimmed string }"as uppercase) = ((value "product_name" of structures "system_information" of smbios) as string as trimmed string as uppercase) "{ (it as string as trimmed string) of node value of child nodes of child nodes whose(node name of it = "version") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client }"as trimmed string as version > ( (it as string as trimmed string as version) of value "bios_version" of structures "bios_information" of smbios )]]> Software Sharing { (it as trimmed string) of unique value of node values of child nodes of child nodes whose(node name of it = "bytes") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client } RESTAPI: Generate Dell BIOS Update Task from Dell Command Update Results - Windows {parameter "currentConsoleUser"} { (current year as string) & "-" & (current month as two digits) & "-" & (current day_of_month as string) } x-fixlet-modification-time Fri, 24 Oct 201417:46:21 +0000 BESC ="Action1"> Click here to update BIOS. ="application/x-Fixlet-Windows-Shell"> with description "Enter BIOS Password, or leave blank if none." and with default value " "
// -- START:DOWNLOADS -------------------------
prefetch BIOS_Update.exe sha1:{ sha1 of file "BIOS_Update.exe" of folder "__Download" of client folder of current site } size:{ (it as trimmed string) of unique value of node values of child nodes of child nodes whose(node name of it = "bytes") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client } https://{ unique value of node values whose(it as trimmed string as lowercase starts with "downloads.dell.com") of child nodes of child nodes whose(node name of it = "file") of parent nodes of parent nodes of xpaths "/updates/update/type/text()" whose(node value of it as trimmed string as uppercase = "BIOS") of xml documents of files "results_DellUpdate.xml" of folders "__BESData\__Global\Logs" of parent folder of client }
// -- END:DOWNLOADS ---------------------------
// DELETE: current log file if it exists delete"{{ pathname of folder "__BESData\__Global\Logs" of parent folder of client }\install_Dell_BIOS_Update.log"
// INSTALL: BIOS Update if{{ ( 4 <= length of (it as trimmed string) of (parameter "BIOS_Password") ) } waithidden __Download\BIOS_Update.exe /s /p={{ (parameter "BIOS_Password") as trimmed string } /l="{{ pathname of folder "__BESData\__Global\Logs" of parent folder of client }\install_Dell_BIOS_Update.log" else waithidden __Download\BIOS_Update.exe /s /l="{{ pathname of folder "__BESData\__Global\Logs" of parent folder of client }\install_Dell_BIOS_Update.log" endif
// http://en.community.dell.com/techcenter/enterprise-client/w/wiki/3462.dup-bios-updates // Report failure if bad return code, continue if good return code continueif{{ exists (exit codes of action) whose(it = 2 OR it = 0 OR it = 6) }
// Import UninstallMSI_Tasks.bes into custom site using API if there is at least one task inside (use secure parameter for user password) if{ (exists files "Tasks.bes" whose(exists contents whose(it contains "") of it) of folder "__Download" of client folder of current site) } // IMPORT // http://stackoverflow.com/questions/3872427/how-to-send-line-break-with-curl waithidden"{ (pathname of file "Curl.EXE" of folder "__Download" of client folder of current site) }" -k -X POST --data-binary @"{pathname of file "Tasks.bes" whose(exists contents whose(it contains "") of it) of folder "__Download" of client folder of current site}" --header "Content-Type:text/xml" -o "{(pathname of folder "__BESData\__Global\Logs" of parent folder of client)}\RESTAPI_ImportedTasksDellBIOS_{parameter "currentSiteName"}.log" --user {parameter "currentConsoleUser"}:{parameter "secret"} https://{parameter "RootServerURL"}/api/tasks/{parameter "currentSiteType"}/{parameter "currentSiteName"} endif
// VERIFY: Check if tasks were actually imported // TODO: Need to add a check to see if the log file was created after the action started running (See adobe CC template for an example) continueif{exists files whose((name of it = ("RESTAPI_ImportedTasksDellBIOS_" & (parameter "currentSiteName") & ".log")) AND exists lines whose(it contains "") of it) of folder "__BESData\__Global\Logs" of parent folder of client}
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.