+ Post New Thread
Results 1 to 3 of 3
Windows Server 2008 R2 Thread, AD User import powershell STUPID issue in Technical; Im have a stupid day so please help me out and then point and laugh My powershell script below running ...
  1. #1
    PEO
    PEO is offline
    PEO's Avatar
    Join Date
    Oct 2007
    Posts
    2,088
    Thank Post
    437
    Thanked 149 Times in 94 Posts
    Rep Power
    71

    AD User import powershell STUPID issue

    Im have a stupid day so please help me out and then point and laugh

    My powershell script below running from my work station logged on as admin and get the follwing error


    Code:
    import-module ac*
    
    $CSV = Import-CSV "C:\bg12.csv"
    $csv | foreach-object {New-ADUser -SamAccountName $_.UserName -UserPrincipalName $_.UserName -Name ($_.Surname + ", " + $_.Forename) -DisplayName ($_.Surname + ", " + $_.Forename) -Surname $_.Surname -GivenName $_.ForeName -Path "ou=12 Users,ou=students,dc=schoolname,dc=campus,dc=council" -AccountPassword (ConvertTo-SecureString -AsPlainText $_.Password -Force) -Enabled $true }
     
    $CSV | foreach-object {Set-ADUser -identity $_.samaccountname -replace @{mail=$_.email}}
    stupid error

    New-ADUser : Directory object not found
    At line:1 char:34
    + $csv | foreach-object {New-ADUser <<<< -SamAccountName $_.UserName -UserPrincipalName $_.UserName -Name ($_.Su
    + ", " + $_.Forename) -DisplayName ($_.Surname + ", " + $_.Forename) -Surname $_.Surname -GivenName $_.ForeName -
    ou=12 users,ou=students,dc=schoolname,dc=campus,dc=counc il" -AccountPassword (ConvertTo-SecureString -AsPlainT
    .Password -Force) -Enabled $true }
    + CategoryInfo : ObjectNotFound: (CN=KIRK \, BRIA...pus,dc=stockton:String) [New-ADUser], ADIdentity
    undException
    + FullyQualifiedErrorId : Directory object not found,Microsoft.ActiveDirectory.Management.Command s.NewADUser

  2. #2

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    114
    I don't have my Stuff[tm] to quickly reference, but offhand if the LDAP path is correct (Path) then it's could well be the Name it doesn't like. One of those properties, probably Name, gets used for the AD user object CN and there's a comma in it which might lead to some code failing to make sense of an object path like:

    CN=Bloggs,Fred,OU=12 Users,OU=Students,DC=....

  3. Thanks to PiqueABoo from:

    PEO (14th June 2012)

  4. #3
    PEO
    PEO is offline
    PEO's Avatar
    Join Date
    Oct 2007
    Posts
    2,088
    Thank Post
    437
    Thanked 149 Times in 94 Posts
    Rep Power
    71
    Cheers i got it sorted in the end.

SHARE:
+ Post New Thread

Similar Threads

  1. Transfer User Area's - Permissions Issues ??
    By mac_shinobi in forum Wireless Networks
    Replies: 24
    Last Post: 21st May 2008, 12:36 PM
  2. AD user field Labels
    By Gatt in forum Windows
    Replies: 4
    Last Post: 9th July 2006, 11:03 AM
  3. Replies: 22
    Last Post: 15th May 2006, 10:50 AM
  4. AD Bulk User Importer
    By ChrisH in forum Scripts
    Replies: 17
    Last Post: 9th May 2006, 07:50 PM
  5. AD User Manager
    By Dos_Box in forum Downloads
    Replies: 0
    Last Post: 27th September 2005, 09:56 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •