I occasionally will setup a user's machine that has been in for repair beyond the simple re-install of the OS. For example: install a new hd, install the OS, create a user, install updates and then reboot into single user mode running a slew of commands to remove that user and give the machine back to the client with the welcome video on boot.
Below are the commands for 10.5 and 10.6 I have used over the years that is a walk-thru for any tech to accomplish regardless of experience. The 10.5 one has worked with 10.6 too, with the exception of line 8 or 9 due to some changes.
I'd like to find a list of commands or a script or something that would be the most proper and efficient way to do this in 10.7. Remove the user, delete any trace of it and on next boot return to the new user setup screen.
Removing a user and returning to the account setup screen (10.5)
- + s at boot (Single-User Mode)
- mount -uw /
- launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist
- dscl -f /var/db/dslocal/nodes/Default
Command prompt changes into Directory Services Command Line Tool
- cd Local/Default/Users
ls - outputs a list
- cd ../Groups
- delete admin GroupMembership
- delete staff GroupMembership
You are now at the Regular Command Prompt
- rm /var/db/.AppleSetupDone
- rm -rf /Users/
- shutdown -h now (Shutdown)
- shutdown -r now (Shutdown and Restart)