Posted on 10-12-2022 05:05 AM
Anyone know how to return the value of <user_approved_mdm since="10.4.0"> using Powershell?
I can get the info in bash using xpath, but I've tried pulling it via powershell (I've got limited knowledge) for one of our teams that only uses Windows.
I know the value is under computer>general>management_status
<management_status> <enrolled_via_dep>true</enrolled_via_dep> <user_approved_enrollment deprecated="10.4.0">true</user_approved_enrollment> <user_approved_mdm since="10.4.0">true</user_approved_mdm> </management_status>
Solved! Go to Solution.
Posted on 10-12-2022 07:14 AM
Was able to figure this out.
Posted on 10-12-2022 05:29 AM
Not to be a jerk, but honestly just provide the bash script and move on. You are managing Macs, not PCs. Bash (ZSH) is native to macOS/Unix, not PowerShell. If they need this information so badly to be in PowerShell let them figure out how to collect it.
If they want a more universal language, bash can be installed on Windows as can Python.
Posted on 10-12-2022 05:47 AM
Yeah I can't really do that when its my VP asking for reports. I like my job.
Posted on 10-12-2022 05:54 AM
Sometimes we have to remind people that macOS is not Windows, and cannot be managed or reported on like Windows. We find ourself often of times needing to educate those who are not familiar, and give correct solutions for the macOS environment. This is a common situation I run in to myself.
JAMF grabs User Approved MDM status natively. A smart group or smart search could be created, and used to export this information in .csv (smart search can schedule reporting). Also JAMF API could be used if they want this in more of an on demand fashion.
Posted on 10-12-2022 06:15 AM
We are using API for his report. I think the issue i'm having is the key <user_approved_mdm since="10.4.0"> the " since="10.4.0"" part is screwing everything up. Because I can easily get the first key <enrolled_via_dep> without issue. Just need someone with PS knowledge to let me know how I can pull that item.
Posted on 10-12-2022 06:21 AM
I believe Powershell plays a lot nicer with json. You could get a json output from the API.
10-12-2022 06:36 AM - edited 10-12-2022 06:39 AM
@boberito is right. The Classic API JSON bug won't bite you if you are only going after management status so JSON is the way to go. There's a lot of help online for JSON with PowerShell. As programmers have been saying about JSON for quite a while now, "at least it's not XML".
If the user just wants a report then do an Advanced Computer Search, save it and email it to them on a regular basis. That's the one part of Jamf Pro - email integration that works really well. It's entirely set and forget.
Posted on 10-12-2022 07:14 AM
Was able to figure this out.