0

I am searching for an example of how to combine Get-ADComputer with AD-GetUser. Get-ADComputer -Filter 'Name -like "Nany-*"' -Properties CN, IPv4Address | Select CN, IPv4Address| Export-CSV "C:\Computers&Users.csv"

This creates the information I'm wanting from the AD-ADComputer command, but I would like to also include the last logged in user and have it be in the same .CSV file

I have found I can do it in two separate scripts, so any ideas on making it one would be great.

Clay
  • 1
  • 1
  • 1
    Does this answer your question? [Combine Get-ADGroup and Get-ADUser Results](https://stackoverflow.com/questions/34550868/combine-get-adgroup-and-get-aduser-results) – Olaf Oct 21 '22 at 20:41
  • You can use a [calculated property](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_calculated_properties?view=powershell-7.2) to combine the results of two or more queries in one output object. – Olaf Oct 21 '22 at 20:42
  • to search for computers and users is one step you can do: ```get-adobject -ldapfilter "(|(&(objectcategory=computer)(samaccountname=nany-*$))(objectcategory=user))"``` but there is no information in AD about where a user has logged on, you only have the datetime information about when the last logon was but not where, – Toni Oct 22 '22 at 09:21

0 Answers0