Running createmobileaccount inside a policy failing...

afurtado
New Contributor

Hello All,

I have a single policy/script that is called during the enrolment phase and takes care of calling other policies to make necessary configs and software installs. Among the actions performed by this policy, the two lines below that are failing. I took the necessary actions to make sure that by the time the lines below are executed the machine will be previously bound to AD. For debug purpose, just before calling those, I execute dsconfigad -show, confirming that the machine was successfully bounded to AD. My intention here is to cache the laptop owner's account during the enrolment.

/System/Library/CoreServices/ManagedClient.app/Contents/Resources/createmobileaccount -vn ${owner}
dseditgroup -o edit -a ${owner} -t user admin

What I see on the logs while trying to cache the user 'dummy''s account:

createmobileaccount built Apr 20 2017 19:34:34
verbose output on.
user name = "dummy"
home path = "(null)"
user password = "(null)"
prompt for password = FALSE
encrypt new home = FALSE
create as external account = TRUE
* user name "dummy" was not found: 0 ((null))
Record was not found.

If I open a shell copy & past those exact two lines, putting a correct value on ${owner} variable first, everything works fine. If call the policy by jamf policy -event [name] it also works. I just can't get it working during the enrolment phase.

I went through similar items on this forum and my problem, I guess, is not about using createmobileaccount correctly, but instead where I'm calling it.

0 REPLIES 0