PowerTip: Use PowerShell to Get a List of Computers and IP Addresses from Active Directory


Summary: Use Windows PowerShell and the Active Directory module to get a listing of computers and IP addresses from Active Directory.

Hey, Scripting Guy! Question How can I get a list of all computers, the operating system version, the service pack, and the IP address from Active Directory?

Hey, Scripting Guy! Answer Use the Get-ADComputer cmdlet and specify the ipv4AddressOperatingSystem, and OperatingSystemServicePack properties, as shown here.

Get-ADComputer -Filter * -Properties ipv4Address, OperatingSystem, OperatingSystemServicePack | Format-List name, ipv4*, oper*

Comments (12)

  1. Anonymous says:

    Hey, Scripting Guy

    If possible can we get the AD site for ever device?

  2. Hi,

    Get-ADComputer retreives the IP configuration from DNS – right? So it's not an actual configuration from the client directly?

  3. That helped me a lot!

  4. Anonymous says:

    the only comment i would make is after Get-AdComputer, is put

    -SearchBase 'OU=Computers,DC=your,DC=domain,DC=com' if  you want to get a SPECIFIC OU vs. the entire domain.  (i realize the question was for AD and might have inferred entire directory but in case you wanted just a small subset, this will do.)

  5. Admin says:

    Great scrip!

  6. Fanaka says:

    i need find "witch user with which IP logged to domain"
    please help me 🙁

  7. Dominique says:

    Hello,
    With
    Get-ADComputer -Filter * -Properties ipv4Address, OperatingSystem, OperatingSystemServicePack | Format-List name, ipv4*, oper* the field ipv4Address is always empty why?
    Thanks,
    Dom

  8. skinrot@live.com says:

    Great post guys. I used Shiv_09’s suggestion and also changed it up a bit to export to csv (excel) for me.
    Get-ADComputer -Filter * -Properties ipv4Address, OperatingSystem | Select-Object name, ipv4*, oper* | Export-CSV list.csv

  9. Nathan says:

    Thank you!

  10. Ken says:

    Hi All,

    I am very new to powershell.

    Using power shell how can I get a list of all the computers in active directory with the users and the group they are in?

    Thanks in advance,

  11. chandurt says:

    Hi

    I need powershell script which gives me complete list of all devices present in an domain in an organization, with the PC hostname , make,model Operating system details, can u suggest me on this

    1. chandurt says:

      Hi

      I need a powershell script which gives me complete list of all devices present in an domain of an organization, with the PC hostname , make,model Operating system, User Name(last logged in User) details, can u suggest me on how to write the script.

Skip to main content