Skip to content

Instantly share code, notes, and snippets.

@phatmandrake
Last active August 3, 2021 20:07
Show Gist options
  • Save phatmandrake/0ba49f50990421dac46d70e4aea78d8e to your computer and use it in GitHub Desktop.
Save phatmandrake/0ba49f50990421dac46d70e4aea78d8e to your computer and use it in GitHub Desktop.
Get the BundleID and CodeSignRequirement from an app bundle by specifying the path. You can then create PPPC profiles directly in JAMF.
function Get-MacOSCodeSign {
param (
[parameter(Mandatory)]
[String]$AppPath
)
process {
$CodesignBundleID = (ConvertFrom-StringData -StringData $(codesign -dv $AppPath 2>&1 | Out-String)).identifier
$CodesignRequirement = (($(codesign -dr - $AppPath 2>&1) | Out-String) | Select-String "(?<=designated \=> ).*").matches.value
@{
BundleID = $CodesignBundleID
CodeRequirement = $CodesignRequirement
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment