Tuesday, May 17, 2016

Mac OS X - Active Directory Mobile Account

Use Command prompt and execute the following command:

/System/Library/CoreServices/ManagedClient.app/Contents/Resources/createmobileaccount

usage: createmobileaccount -n username [-h homepath] [-P | [-p password]] [-e] [-q] [[-x] | [-X]] [[-s] | [-S]] [-u syncURL] [-t urlPath] [-d] [-v]
-n username : user record name.
-h homepath : user home path; Default is "/Users/<username>".
-p password : user password.
-P : prompt for user password. A user password is required to create a FileVault home.
-e encrypt : encrypt new home with FileVault.
-q quota : max size in bytes of FileVault home.
-x : create as external account on non-boot volumes. Default.
-X : create as mobile account account non-boot volumes.
-d : disable external account creation.
-s : set home sync on if home created.
-S : set home sync off if home created. Default.
-u syncURL : server target of home synchronization.
-t urlPath : additional path after syncURL.
-v : verbose output.
Examples:
createmobileaccount -n jsmith
createmobileaccount -v -P -n jsmith
createmobileaccount -vsxn jsmith -h /Volumes/HD3/jhome
createmobileaccount -vsxn jsmith -h /Volumes/HD3/jhome -u nfs:/server.apple.com/bigs/homes -t myusers/macos/jhome
Notes:
- createmobileaccount must run as root.
- If you do not specify a password, the account's cached password will be created during the account's first log in.

createmobileaccount -vsxn COYOTEID -h /Users/COYOTEID


The OpenDirectory cached the users password locally. To delete cached information that is no longer valid other than to delete the information, we had to delete the user while keeping the users homedirectory.

sudo dscl . -remove /Users/[username]
This will remove the user [username] from the userlist but keeps the homedirectory as it is.

Note: You should only do so with a cached mobile user!!!! To find out about your cached users run this snippet:


dscl . -list /Users AuthenticationAuthority | grep LocalCachedUser | awk '{print $1}'

Friday, March 25, 2016

PowerShell - Rename Computer in Active Directory

Execute the command below and restart the computer.

Rename-Computer -ComputerName "OLD_COMPUTER_NAME" -NewName "NEW_COMPUTER_NAME" -DomainCredential $cred