none
how to search two different ou in same power shell command RRS feed

  • Question

  •  Get-ADUser -Filter * -SearchBase "ou=testou,dc=Domain,dc=net" -and "ou=salseou,dc=Domain,dc=net" -and "ou=VIP,ou=new,dc=Domain,dc=net"

    above commands is not helping me to get specific these OU user details. Please correct this poweshell command


    Raj

    Saturday, May 10, 2014 6:58 AM

Answers

  • HELP Get-ADUser -Parameter SearchBase

    Read carefully


    ¯\_(ツ)_/¯

    • Marked as answer by Raja Y Saturday, May 10, 2014 11:34 AM
    Saturday, May 10, 2014 8:17 AM

All replies

  • HELP Get-ADUser -Parameter SearchBase

    Read carefully


    ¯\_(ツ)_/¯

    • Marked as answer by Raja Y Saturday, May 10, 2014 11:34 AM
    Saturday, May 10, 2014 8:17 AM
  • Check your logic

    -or NOT -and

    However, searchbase is a string, not an array, so you can't do this.

    You can however, pass the OU's into a foreach loop as follows...

    'OU=testou,DC=domain,DC=net','OU=salesou,DC=domain,DC=com','OU=VIP,ou=new,dc=domain,dc=net' | 
    % { Get-ADUser -Filter * -SearchBase $_ }
    



    • Edited by Newbie Jones Saturday, May 10, 2014 10:44 AM You can NOT can can
    Saturday, May 10, 2014 10:36 AM