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

I want to copy a user account from my production domain to my test domain. Here is what I am trying:

$me = Get-QADUser myAccount -IncludeAllProperties -connection $prodDomain
$me | New-QADUser -parentcontainer 'domain.local/test' -connection $testDomain

On the new account, the only thing copied across is the CN. None of the other attributes - samAccountName, FirstName, exchange attributes etc, have come across. What am I doing wrong?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Unfortunately you need to specify each value you want copied across at the moment. New-QADUser does not accept parameter values by pipeline input right now. If you would like this support to be added, please request it on the PowerGUI forums (http://powergui.org). I already requested this feature, however I work at Quest so they won't necessarily listen to me! :)

In the meantime, to copy a user you'll have to do something like this:

$me = Get-QADUser myAccount -IncludeAllProperties -connection $prodDomain
New-QADUser -Name $me.Name -SamAccountName $me.SamAccountName -Title $me.Title -Department $me.Department ... -ParentContainer 'domain.local/test' -Connection $testDomain

(the ellipsis was added to save time...you should fill in the blank with the attributes you want to copy over).

share|improve this answer

Have you looked at what $me returns? it might be that whatever $me is, it may not be what New-QADUser was expecting

Worst case is you may need to break out the values of $me into an @array{}, and then populate using the -ObjectAttributes Parameter for New-QADUser. I can't actually test this right now, so have been using this wiki info:

http://wiki.powergui.org/index.php/New-QADUser

share|improve this answer

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.