Check for account create if missing update password if exisiting
![Andy_McCaskill Andy_McCaskill](https://community.jamf.com/legacyfs/online/avatars/f5609601fb1546909eb528a3cc09bada.jpg)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 09-21-2016 11:29 AM
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!
Labels:
- Labels:
-
Remote Control
-
user group
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 09-21-2016 11:47 AM
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}
![](/skins/images/7A78D7C88289EF2AF98187830A5F8AAB/responsive_peak/images/icon_anonymous_message.png)