Comments (4)

  1. Mike Crowley says:

    Why do we need to get into WMI?  Something like should work too and is a little simpler:

    $UserList = get-content c:usernamelist.txt

    Foreach ($Item in $UserList) {

    $tempcount = (Get-aduser -filter {displayname -eq $Item}).count

    if ($tempcount -lt 1) {Write-Host $Item  "Not Valid"}

    }

  2. PashaR says:

    This works fine for single domain

    get-content C:tempRPtest-scriptsUserInput.txt | %  {

    $user = Get-QADUser $_

    if (!$user){

         "User $_ could not be found"

    } else {

       Get-QADUser $user | SELECT NTAccountName,DisplayName,samAccountName }} |

    Out-File C:tempRPtest-scriptsUseroutput.txt

    Need Help: can anyone edit this script to check in muliple domains / accross forest...

    Regards,

  3. PashaR says:

    UserInput.txt : this file has AD users from multiple Domains with samAccountName (only )

    Useroutput.txt : the script will look for all the users from UserInput.txt against AD and sends the result to Useroutput.txt

  4. Refuses to upgrade says:

    @mike

    The reason is that the Get-ADUser cmdlet is not available on Windows XP, only with the RSAT tool installation.

    In this case, I'm stubborn and won't use the Quest (Get-QADUser) either. This is the best way without those tools.

Skip to main content