Ok - I found the problem with the script. The inner "{" had to be commented out also, then it is just like your "all" script. If the inner "{" are left in, the result is the output I posted earlier.
But, there is another issue - this still does not return all the approvals in that have taken place. We do have many approvals in the last 30 days.
It only returned items in this range: 5/21/2012 12:00:00 AM to 6/26/2012 12:00:00 AM
Is there a resultsize limitation?
[Reflection.Assembly\]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$admNS = New-Object("Softerra.Adaxes.Adsi.AdmNamespace")
$admService = $admNS.GetServiceDirectly("localhost")
# Bind to the Approval Requests container
$containerPath = $admService.Backend.GetConfigurationContainerPath("ApprovalRequests")
$container = $admService.OpenObject($containerPath.ToString(), $NULL, $NULL, 0)
# Get approval requests
$state = "ADM\_APPROVALSTATE\_APPROVED"
#$state = "ADM\_APPROVALSTATE\_DENIED"
#$state = "ADM\_APPROVALSTATE\_CANCELED"
$requests = $container.GetApprovalRequests($state)
$startDateTime = (Get-Date).AddDays(-30)
# Iterate through the requests
foreach ($requestID in $requests)
{
# Bind to the approval request
$guid = New-Object "System.Guid" (,$requestID)
$guid = $guid.ToString("B")
$requestPath = "Adaxes://<GUID=$guid>"
$request = $admService.OpenObject($requestPath, $NULL, $NULL, 0)
# if ($request.CreationDate -gt $startDateTime)
# {
Write-Host "Date: " $request.CreationDate
Write-Host "Operation:" $request.DescriptionOfOperationToApprove
Write-Host "ProcessedBy:" $request.ProcessedBy.Get("name")
Write-Host "Requestor:" $request.Requestor.Get("name")
Write-Host
# }
}