Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been working on a PS script that will prompt me for several criteria, then create an Exchange/AD account. It's all going well, but I was thinking, is there a command that will create a new user similar to another user? Typically in our organization most users are setup very similar to others in their department. So if John Doe starts in Accounting, basically I would set him up similar to Jane Smith already in Accounting. He could have a slightly different title (Accountant I vs Accountant II), but other items like the floor he's on, the groups he's in in AD, etc would all be the same. Is there a PS (or otherwise) command that will say "Add-User -like Jane" or something where I could say, "create new user, keep -description -location -ADGroups the same as user Jane", then prompt for the remainder so I could fill it the rest in manually (telephone number, etc)?

It may be a stretch, but it seems once that were done that would just make it that much quicker and efficient for me to set the person up. Any thoughts are welcome, thanks!

share|improve this question
    
That what the hidden Default User profile is for. It's a template for new users, but I am not sure how to have multiple profiles and apply them. There are also GPOs and Group Policy Preferences, which would be easy to make different sets of. –  paradroid Mar 27 '12 at 18:54

1 Answer 1

up vote 5 down vote accepted

Yes, you can. I followed this blog and it worked fine: http://dmitrysotnikov.wordpress.com/2008/01/10/copy-ad-accounts-with-powershell/

I am quoting the relevant portion.

Get-QADUser 'James Johns' -export | New-QADUser -ParentContainer mydomain.local/test -Name 'Janny Grant' -SamAccountName jgrant -DisplayName 'Janny Grant' -FirstName Janny -LastName Grant -UserPassword 'J@nnysPwd' -import

One gotcha is that it will not copy the group membership, so you will have to use another oneliner for that:

(Get-QADUser 'James Johns').MemberOf | Add-QADGroupMember -Member ps64\jgrant
share|improve this answer
    
You may have to adapt a little though. –  johnshen64 Mar 27 '12 at 18:57
    
John, merely linking to content is frowned upon here. If that page ever moves or goes down at some point in the future (which it will), your answer becomes worthless. So - please provide relevant bits of information here in your answer, of course giving attribution to the original source where necessary. –  EEAA Mar 27 '12 at 19:08
    
ah, ok, sure. i did not want to plagirize as I used someone else's idea and did not come up with my own. Yeah, just edited my answer as you have suggested. Thanks! –  johnshen64 Mar 27 '12 at 19:12
    
Thanks John. Actually, can you just edit your answer and include the content you posted as a comment? That way, we can take advantage of code formatting, etc. –  EEAA Mar 27 '12 at 19:13
    
Thanks for the quick reply! I don't see the "Q-ADUser" cmdlet on my PC. After reading online a bit I assume this is part of Quest AD plugins? Looks to be a paid solution though...is there any way to do this without buying an add-on? Thanks! –  Don Mar 27 '12 at 19:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.