Good day,
I'm working on compliance script which would check the latest OS build in Jamf portal ( Computers > Patch Management > macOS ) and then compares the value on MacBook. If value is greater than equals to value from API script then device would be considered compliance otherwise not compliant.
I'm able to get value using PowerShell but need help to convert PowerShell script to Bash in order to use as extension attribute.
Here is the PowerShell script :-
Set JAMF REST API account credentials and create credentials object
$Username = ""
$JSSAPIPass = ""
$Password = ConvertTo-SecureString -String $JSSAPIPass -AsPlainText -Force
$Credentials = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $Username, $Password
/patchsoftwaretitles/id/{id} Finds a patch software titles by ID - macOS
$deviceurl = "https://YOURDOMAIN.jamfcloud.com/JSSResource/patchsoftwaretitles/id/10"
$InvokeCommand = Invoke-RestMethod -Uri $deviceurl -Method get -Credential $Credentials -Headers @{"content-type" = "application/xml"}
$latestOSBuild = $InvokeCommand.patch_software_title.versions.version.software_version | Select-Object -First 1
Write-host $latestOSBuild
Any help would be appreciated. TIA
Link for Classic API: https://www.jamf.com/developers/apis/classic/reference/#/patchsoftwaretitles/PatchsoftwaretitlesIdByIdPost