I am trying to figure out how to deploy a script to our users that deregisters the O365 suite. On the Microsoft site I have found the following Terminal command:
This works like a charm when I run it locally, but when I try to run it through Jamf (selfService) it gives no result. I think this might be because the script through Jamf does not run as the logged in user.
This is what I have sofar:
#!/bin/bash #Remove all Microsoft users defaults write com.microsoft.Word ResetOneAuthCreds -bool YES
hoping there is someone that can point me in the right direction here.
Best answer by TheHoff
Managed to solve it myself with the help of ChatGPT. Did not know about the $USER possibility of sudo.
To send the defaults write command through Jamf to run as the local user, you can create a Jamf policy with a script payload that utilizes the sudo command to execute the command as the current user. Here's how you can achieve this:
#!/bin/bash #Remove all Microsoft users sudo -u $USER defaults write com.microsoft.Word ResetOneAuthCreds -bool YES
When the policy is executed on the devices, the script payload will run the specified defaults write command using sudo -u $USER, which runs the command as the current user.
@TheHoff If you're looking to remove the Office license(s) from a Mac you can use the License Reset Package from https://office-reset.com/macadmins/ (that site and the removal tool were created by @pbowden from Microsoft)
Managed to solve it myself with the help of ChatGPT. Did not know about the $USER possibility of sudo.
To send the defaults write command through Jamf to run as the local user, you can create a Jamf policy with a script payload that utilizes the sudo command to execute the command as the current user. Here's how you can achieve this:
#!/bin/bash #Remove all Microsoft users sudo -u $USER defaults write com.microsoft.Word ResetOneAuthCreds -bool YES
When the policy is executed on the devices, the script payload will run the specified defaults write command using sudo -u $USER, which runs the command as the current user.
Managed to solve it myself with the help of ChatGPT. Did not know about the $USER possibility of sudo.
To send the defaults write command through Jamf to run as the local user, you can create a Jamf policy with a script payload that utilizes the sudo command to execute the command as the current user. Here's how you can achieve this:
#!/bin/bash #Remove all Microsoft users sudo -u $USER defaults write com.microsoft.Word ResetOneAuthCreds -bool YES
When the policy is executed on the devices, the script payload will run the specified defaults write command using sudo -u $USER, which runs the command as the current user.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.