Being able to copy AD accounts with one line of PowerShell code is probably my favorite feature of AD cmdlets RTM version.
Suppose you have an account the properties of which you would like to use to create another account? You probably want the new account to have a different name, password, etc. but it needs to have the same location, department and other attributes. The solution is extremely easy and straight-forward. You just need to do
Get-QADUser for the sample account, and pipe into
New-QADUser while specifying the new location and unique properties.
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
How cool is that? 😉