Skip to main content
Question

Script doesn't run via Policy


Forum|alt.badge.img+4
  • Contributor
  • 22 replies

I have a script that only runs locally - not via policy. Can anyone tell me what I'm doing wrong?

#!/bin/bash

loggedInUser=$(ls -l /dev/console | awk '{print $3}')

defaults write /Users/$loggedInUser/Library/Preferences/com.microsoft.autoupdate2.plist HowToCheck "Manual"

2 replies

Forum|alt.badge.img+4
  • New Contributor
  • 11 replies
  • March 26, 2018

If you want to enforce the manual check for office updates you can try a custom configuration profile.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>HowToCheck</key>
    <string>Manual</string>
</dict>
</plist>

Forum|alt.badge.img+16
  • Valued Contributor
  • 1002 replies
  • March 26, 2018

How are you invoking the policy? If it runs when no one is logged in it will do nothing as $loggedInUser will be empty.
If your running it as Login or Self Service you can use $3 directly as this will contain the username that either logged in or signed into Self Service. Outside of that contect you need to ensure that there is someone logged in.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings