We're moving AD so need to change domains in Outlook.
I've got an AppleScript that runs in SelfService no problem.
#!/usr/bin/osascript
tell application "System Events"
set shortName to name of current user
end tell
tell application "Microsoft Outlook"
set domain of exchange account 1 to "domainname"
set the user name of exchange account 1 to shortName
end tell
It doesn't run via policy so I've tried to wrap it in a bash script, but no dice... any help much appreciated!
#!/bin/sh
# Discover logged in user
user=`stat -f%Su /dev/console`
sudo -u $user /usr/bin/osascript <<EndMigration
tell application "System Events"
set shortName to name of current user
end tell
tell application "Microsoft Outlook"
set domain of exchange account 1 to "domainname"
set the user name of exchange account 1 to shortName
end tell
EndMigration