-ge $Start.Date -AND PasswordLastSet -le $End.Date } -properties * | Select DistinguishedName,PasswordLastSet, @{Name="PasswordAge";Expression={(Get-Date) - $_.PasswordLastSet }} } Catch { #there was a problem so display a warning and the exception message Write-Warning "Failed to query user accounts in $searchbase." Write-Warning $_.Exception.Message }