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
- Edited by Analyst_dudu Friday, February 20, 2015 7:02 PM