Get AD information on all DHCP Servers -- POWERSHELL RRS feed

  • Question

  •  get-dhcpserverindc | Get-ADComputer -Property *

    Get-ADComputer : The input object cannot be bound to any parameters for the command either because the command does

    not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.

    At line:1 char:22

    + get-dhcpserverindc | Get-ADComputer -Property *

    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidArgument: (DhcpServerInDC:PSObject) [Get-ADComputer], ParameterBindingException

        + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.ActiveDirectory.Management.Commands.GetADComputer

    I need an easy command to export the data to csv.  I don't understand why the pipe is not working.

    Here is the part of the command I would add on to get to a csv.

    | Select-Object Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion,Description,Enabled,DistinguishedName


    Thursday, February 23, 2017 10:11 PM

All replies

  • Hi Jlawson,

    According to the information that you provided, I suggest that you could post it to Powershell forum to get effect support.

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Friday, February 24, 2017 5:51 AM
  • I'm getting close:

    I do the top line in order to separate multiple domains:

    # Multi domain version to eliminate other domain dhcp servers:
    $DHCPs = get-dhcpserverindc | where-object {$_.DnsName -like “*” + $env:userdnsdomain.tolower()}
    $dhcps | foreach-object {Get-ADComputer $_.DNSName -property *}
    #Single domain version:
    get-dhcpserverindc | foreach-object {Get-ADComputer $_.DNSName -property *} 

    My problem is I'm getting back this error:
    Get-ADComputer : Cannot find an object with identity: '' under:

    I will keep plugging away to see if I can figure this out.  Please if someone has suggestions let me know.

    Friday, February 24, 2017 11:20 PM
  • Get-ADComputer cmdlet expects an object of ADComputer type as an input, which can be the one of the following only:

    Distinguished Name
    Example: CN=SaraDavisDesktop,CN=Europe,CN=Users,DC=corp,DC=contoso,DC=com

    GUID  (objectGUID)
    Example: 599c3d2e-f72d-4d20-8a88-030d99495f20

    Security Identifier (objectSid)
    Example: S-1-5-21-3165297888-301567370-576410423-1103

    Security Accounts Manager Account Name (sAMAccountName)
    Example: SaraDavisDesktop

    Note, there is no FQDN in the list. |

    • Edited by Kirill Nikolaev Saturday, February 25, 2017 10:46 AM
    • Proposed as answer by Kirill Nikolaev Thursday, March 2, 2017 7:22 PM
    • Unproposed as answer by jLawson23 Thursday, March 2, 2017 8:51 PM
    Saturday, February 25, 2017 1:20 AM