I am currently trying to figure out how to script a process, to create a backup of a user profile and restore it to a new system… The design of the application is as follows:
The Backup portion of the script allows:
- Identify the computer name and create a folder on our NAS under //NAS/Public/Backup/computername
- ```
hdiutil create smb://MyNAS/Public/computername/{backupusername}.dmg -volname "{username}" -srcfolder /Users/username’
So for example on the Backup FileSet script I will have as launch arguments, the username of the profile I want to backup, that way the script will know what to backup and will place it on the //NAS/Public/Backup/computernameenm.dmg for example
The restore script will then:
- the launch arguments will have the computer name, and the username, so it will know to go to //NAS/Public/Backup/ and find the computer name in question, and the bend.dmg to extract
- for restoring the profile will be done with this line: ```
sudo asr restore -source smb://NAS/Public/Backup/computername/benm.dmg —target /Users/ -noprompt -noverify -erase - will inject the command: ```
/System/Library/CoreServices/ManagedClient.app/Contents/Resources/createmobileaccount -n$(ls -l /dev/console | awk '{ print $3 }') S
``` to enable the mobile account into the profile so the user can log in.
Do you guys have another suggestion how I can approach this? any links you can provide to examples would be great.