Powershell Get-ADUser returns Computer objects as well ???! How to prevent.

I ran the following script and got a bunch of computer objects in my csv. How to i Prevent this? I already tried using 

Where-Object{$_.type -eq "user"} OR

 -filter{type -eq "user"}

script:

Get-ADUser-Filter*-PropertiessamAccountName,accountExpires,Created,LastLogonTimeStamp,Department,physicalDeliveryOfficeName,employeeID,AccountExpirationDate,Manager|

Where-Object

{$_.accountexpirationdate -lt$timex} |


select

Name,samAccountName,@{Name="Timestamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}},@{n='Date Created';e={$_.created}},Department,@{n='Location';e={$_.physicalDeliveryOfficeName}},employeeID,AccountExpirationDate,@{Label='Manager sAMAccountName';Expression={(Get-ADUser$_.Manager).sAMAccountName}},@{Label='Manager Name';Expression={(Get-ADUser$_.Manager).name}} |


export-csv

-path$mypath-notypeinformation


February 20th, 2015 10:00pm

I've never seen a computer object returned by Get-ADUser in any way.

Are you sure there's nothing strange with the computer objects themselves?

Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 10:09pm

Someone told me the Computer accounts are generic accounts...makes any sense?
February 20th, 2015 10:15pm

Someone told me the Computer accounts are generic accounts...makes any sense?
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 10:16pm

Specifically, what are the values of sAMAccountName, oblectClass (all values), and objectCategory when you view the object properties on the "Attribute Editor" tab in ADUC properties?

February 20th, 2015 11:39pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics