Skip to main content
Question

Check for account create if missing update password if exisiting

  • September 21, 2016
  • 1 reply
  • 0 views

Forum|alt.badge.img+5

Hi everyone,

I am not the greatest at creating scripts. I was wondering if any of you could assist with a small management script I want to create.

I need a script to look for a local account on a computer. If the account is missing, it will create it. If the account is there, reset the password to a given entry.

Thank you all in advance for any assistance on creating this script!

1 reply

dan-snelson
Forum|alt.badge.img+28
  • Honored Contributor
  • 627 replies
  • September 21, 2016

We use something along these lines to create the admin account (and we use a JSS Policy Local Accounts payload to reset it).

/bin/mkdir -p /private/var/${adminAccount}
/usr/sbin/sysadminctl -addUser ${adminAccount} -fullName ${adminAccount} -UID ${adminUID} -password "${adminPassword}" -home "/private/var/${adminAccount}" -admin
/usr/sbin/chown ${adminAccount} /private/var/${adminAccount}

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