Workflow/Script Problem

I am fairly new to the Active Roles platform and have been trying to create workflows for deprovisioning/removing old licensing.

I use a search function and then deprovision, this is the function I have that the search references:

function ExportTest($Request)
{

#Workflow search name
$SearchName = [string]$PolicyEntry.Parameter("Define workflow action name")
$Filename = [string]$PolicyEntry.Parameter("Filename")

#$PolicyEntry.Parameter("Filename") | Out-File "C:\temp\policyname2.csv"


$Filepathprefix = "C:\temp\"
$Filepathsuffix = ".csv"
$currentDate = Get-Date -Format "yyyy-MM-dd"
$Filepath = $Filepathprefix + [string]$PolicyEntry.Parameter("FileName") + " - " + $Currentdate + $Filepathsuffix
$Currentdate | Out-File "C:\temp\filedate.csv"

$Usersam = $workflow.FoundObject($SearchName).get("samaccountname")
$UserLPD = $workflow.FoundObject($SearchName).get("pwdlastset")
$UserLLD = $workflow.FoundObject($SearchName).get("lastlogon")


Add-Content -Path $filepath -Value $Usersam, $UserLPD, $UserLLD

}

This creates an out file that allows me to review the search. This works when I use [$Usersam = $workflow.FoundObject($SearchName).get("samaccountname")] but as soon as I use the following two lines to gather the password last set date and last logon date it errors out. I must not be seeing something, does anyone have some thoughts?