I am using the powershell command below to read a csv file and match the computer name to the employee name where the last login date is 181 days old. For some reason the Employee_Name column in the output is only displaying {} on each row. Any idea why its not returning the employee name?
Import-Module ActiveDirectory $Days = (Get-Date).AddDays(-181) $Computers = @{} Import-CSV -Path c:\PS\ComputerNames.CSV | % { $Computers[$_.Computer_Name] = $_.Employee_Name } Get-ADComputer -Property Name,lastLogonDate -Filter {lastLogonDate -lt $Days} -Server servername -Searchbase "OU=US,DC=Domain,DC=net" | ? { $Computers.Keys -contains $_.Computer_Name } | select Name,lastLogonDate,@{n='Employee_Name';e={$Computers[$_.Computer_Name]}} | ft