header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Setting attribute in bulk
Last Post 19 Sep 2011 12:10 PM by uSlackr. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
uSlackrUser is Offline
New Member
New Member
Posts:68
Avatar

--
19 Sep 2011 12:10 PM
    I am writing a series of scripts to help me copy active directory objects from one domain (Prod) to another (Test).  i have most of this working.  After I "finished", I found that certain attributes are not being set.  I understand now that the issue is because Set-Aduser only accepts certain attributes.  Perhaps someone can assist with a straight forward solution.

    My process works like this
    - user Get-ADUser to export a bunch of user objects and attributes to a csv file

    - on the test server, import the csv and for each user object imported, modify the DN to reflect the new domain and create a user like this:

    $userlist = import-csv $myfile
    $userlist |foreach { 
        #fixup UPN
        $_.UserPrincipalName = $_.UserPrincipalName -replace , $OldDomain, $NewDomain
            
        #fixup DN & make path. Path is DN minus the first field 
        $_.Distinguishedname = $_.Distinguishedname -replace , $OldDomain, $NewDomain
        $Path = $_.Distinguishedname -split ',',2
        $Name = $_.Name
        $user = $_

        $user|New-ADUser -Path $Path[1] -EA Stop

    }

    Passing in the user object like I do in the last line works fine for most attributes, but some, like extensionattribute1, are not populated.  I assume this is because set-ADUser does not support them directly.  

    Any idea how best to approach setting these non-default attributes?

    \\uSlackr
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer