0

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?

2 Answers 2

1

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).

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .