locked
get-aduser command failing RRS feed

  • Question

  • Hi everyone,

    I am trying to run the following command:

    Get-ADUser -Filter * -SearchBase "OU=Users,OU=COB,DC=mydomain,DC=local" -Properties * -ErrorAction SilentlyContinue

    It works at first then hits 'something' in AD and throws an error:

    Get-ADUser : Object reference not set to an instance of an object.
    At line:1 char:1
    + Get-ADUser -Filter * -SearchBase "OU=Users,OU=COB,DC=brampton,DC=ca" -Properties ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Get-ADUser], NullReferenceException
        + FullyQualifiedErrorId : Object reference not set to an instance of an object.,Microsoft.ActiveDirectory.Management.Commands.GetADUser

    I don't really care what's causing it to fail, if it would just ignore whatever record it doesn't like and continued I would be fine with that.

    Any suggestions?

    Thursday, September 15, 2016 6:40 PM

Answers

  • You can't ignore errorss of that type.

    Try this first:
    Get-ADUser -Filter * -SearchBase "OU=Users,OU=COB,DC=mydomain,DC=local"


    \_(ツ)_/

    • Marked as answer by dbutch1976 Thursday, September 15, 2016 8:03 PM
    Thursday, September 15, 2016 7:03 PM

All replies

  • You can't ignore errorss of that type.

    Try this first:
    Get-ADUser -Filter * -SearchBase "OU=Users,OU=COB,DC=mydomain,DC=local"


    \_(ツ)_/

    • Marked as answer by dbutch1976 Thursday, September 15, 2016 8:03 PM
    Thursday, September 15, 2016 7:03 PM
  • That worked, not sure what's wrong, is '-properties *' causing it?
    Thursday, September 15, 2016 8:03 PM
  • Some properties may cause issues.  Try just requesting the properties you need.

    \_(ツ)_/

    Thursday, September 15, 2016 8:16 PM