none
2008 R2 AD search for multiple computers

    Întrebare

  • I have a list of computer names I would like locate within AD (2008 R2), using the search feature it seems I can only do one at a time, I have also discovered the ADAC but not sure if that can handle a search like that either.

    Once located these machines will be dropped into their respective OU's at one time.


    22 iunie 2012 12:32

Răspunsuri

Toate mesajele

  • You should write a script to do this.  There are plenty of examples in the repository.
    http://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=RootCategory&f%5B0%5D.Value=activedirectory&f%5B0%5D.Text=Active%20Directory&f%5B1%5D.Type=SubCategory&f%5B1%5D.Value=computeraccounts&f%5B1%5D.Text=Computer%20Accounts

    --
    Paul Bergson
    MVP - Directory Services
    MCITP: Enterprise Administrator
    MCTS, MCT, MCSE, MCSA, Security+, BS CSci
    2008, Vista, 2003, 2000 (Early Achiever), NT4
    http://blogs.dirteam.com/blogs/paulbergson  Twitter @pbbergs
    Please no e-mails, any questions should be posted in the NewsGroup. This posting is provided "AS IS" with no warranties, and confers no rights.

    22 iunie 2012 12:47
  • I have a list of computer names I would like locate within AD (2008 R2), using the search feature it seems I can only do one at a time, I have also discovered the ADAC but not sure if that can handle a search like that either.

    Once located these machines will be dropped into their respective OU's at one time.


    I dont think this is possible using ADUC. Are you trying to search groups of computer list ? ( Eg - Computers having similar OS or computer account which got disabled Etc)?

     If this is the case , then I agree with paul you need to write a script to accomplish this.

    I would recommend you to ask this is in official scripting forum with your exact requirement

    http://social.technet.microsoft.com/Forums/en-US/ITCG/threads

    Regards,

    _Prashant_


    MCSA|MCITP SA|Microsoft Exchange 2003 Blog - http://prashant1987.wordpress.com Disclaimer: This posting is provided AS-IS with no warranties/guarantees and confers no rights.

    22 iunie 2012 12:58
  • I already have a text file containing the computer names I want moved, I just want to move them all at once into another OU.

    Perhaps a "Dsmove" command?

    22 iunie 2012 13:02
  • Hi,

    You can use Powershell with ActiveDirectory module

    For exemple :

    Import-Module ActiveDirectory
    
    $LISTPC = Get-Content C:\temp\LISTPC.txt
    
    $LISTPC|Foreach{Get-ADComputer $_|Move-ADObject -TargetPath "OU=TARGET,DC=...."} 

    Regards,

    22 iunie 2012 13:10
  • Looks like that might do the trick, however when I enter the following:

    $LISTPC|Foreach{Get-ADComputer $_|Move-ADObject -TargetPath "OU=Computer,OU=OUNAME,DC=DCNAME,DC=DCNAME,DC=net"}

    It does not throw any errors but it does not move the object inside the "LISTPC" txt file.

    The first part of the command works just fine 

    Import-Module ActiveDirectory
    
    $LISTPC = Get-Content C:\temp\LISTPC.txt

    22 iunie 2012 13:31
  • Make sure you refresh the ADUC (Hit F5) after selecting the OU

    --
    Paul Bergson
    MVP - Directory Services
    MCITP: Enterprise Administrator
    MCTS, MCT, MCSE, MCSA, Security+, BS CSci
    2008, Vista, 2003, 2000 (Early Achiever), NT4
    http://blogs.dirteam.com/blogs/paulbergson  Twitter @pbbergs
    Please no e-mails, any questions should be posted in the NewsGroup. This posting is provided "AS IS" with no warranties, and confers no rights.

    22 iunie 2012 14:40
  • I did, but the machine has not moved from it's original location, does the machine name listed in the "LISTPC" txt file have to be in a certain format? I simply have the name listed as is "machinename" (no quotes of course)

    Does the following look correct? Dis I mis something in this line?

    $LISTPC|Foreach{Get-ADComputer $_|Move-ADObject -TargetPath "OU=Computer,OU=OUNAME,DC=DCNAME,DC=DCNAME,DC=net"}

    22 iunie 2012 16:04
  • Disregard, all is working, I was running the ADM for PowerShell on  my own machine instead of running it on the DC thinking I could connect to the DC with that utility from my own machine. Thanks for all your help!
    22 iunie 2012 16:21
  • Actually, I tried the command on the same LISTPC txt file containing about 40 machine names and it errored out, so it did work for one but not several machines?

    Get-ADComputer : Cannot bind parameter 'Identity' to the target. Exception setting "Identity": "Cannot validate argumen
    t on parameter: 'Identity'. The argument is null or empty. Supply an argument that is not null or empty and then try th
    e command again."
    At line:1 char:31

    22 iunie 2012 16:32
  • Well I hate to admit it but I think I just had an extra space at the end of the command, I will test further and keep you posted.
    22 iunie 2012 18:02
  • Put the content of .txt file into a .csv file, Name the column as "Name" and run the following command:

    Import-Csv D:\file.csv | foreach {get-adcomputer $_.Name} | Move-ADObject $_.Name -TargetPath "OU=TARGET,DC=...."

    Worked for me...





    15 august 2013 17:51