I have created a local admin account using below given script and its working fine for me.
#!/bin/sh
#Creating a new user.
dscl . -create /Users/test6
#Setting users default shell.
dscl . -create /Users/test6 UserShell /bin/bash
#Setting up users Full Name
dscl . -create /Users/test6 RealName TEST6
dscl . -create /Users/test6 UniqueID 512
dscl . -create /Users/test6 PrimaryGroupID 20
dscl . -create /Users/test6 NFSHomeDirectory /Users/test5
dscl . -passwd /Users/test6 123456
dscl . -append /Groups/admin GroupMembership test6
I am not enough knowledgeable in scripting part.
I am looking for solution code for searching next available UniqueID from the system when i run the script.any idea will appreciated.