diff --git a/DSCPullServerAdmin/DSCPullServerAdmin.psd1 b/DSCPullServerAdmin/DSCPullServerAdmin.psd1 index 8854e76..6efe783 100644 --- a/DSCPullServerAdmin/DSCPullServerAdmin.psd1 +++ b/DSCPullServerAdmin/DSCPullServerAdmin.psd1 @@ -126,12 +126,10 @@ PrivateData = @{ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = 'Cross Platform support (Only SQL is supported xPlat. MDB and ESE are not) -* Removed Microsoft.Isam.Esent.Interop from RequiredAssemblies -* Load Microsoft.Isam.Esent.Interop when available -* removed RetrieveColumnAsGuid and moved properties to RetrieveColumnAsString as something broke on latest w10 insiders + ReleaseNotes = 'EDB Fixes: -* Fix ad-hoc mdb database access did not process as PreProc was missing MDB logic' +* StatusReport move from Last to Previous. Issue: #43. +* Registration and devices from from First to Next. Issue: #51' } # End of PSData hashtable diff --git a/DSCPullServerAdmin/private/Get-DSCPullServerESERecord.ps1 b/DSCPullServerAdmin/private/Get-DSCPullServerESERecord.ps1 index 2b56d7b..babe16e 100644 --- a/DSCPullServerAdmin/private/Get-DSCPullServerESERecord.ps1 +++ b/DSCPullServerAdmin/private/Get-DSCPullServerESERecord.ps1 @@ -40,23 +40,6 @@ function Get-DSCPullServerESERecord { [uint16] $Top ) begin { - $stringColumns = @( - 'TargetName', - 'ServerCheckSum', - 'TargetChecksum', - 'NodeName', - 'OperationType', - 'RefreshMode', - 'Status', - 'LCMVersion', - 'ReportFormatVersion', - 'ConfigurationVersion', - 'RebootRequested', - 'JobId', - 'Id', - 'ConfigurationID' - ) - $boolColumns = @( 'NodeCompliant', 'Dirty' @@ -94,7 +77,10 @@ function Get-DSCPullServerESERecord { process { try { $recordCount = 0 - while ([Microsoft.Isam.Esent.Interop.Api]::TryMoveNext($Connection.SessionId, $Connection.TableId)) { + $FirstMove = $true + + while (Move-DSCPullServerESERecordPosition -Connection $Connection -Table $Table -FirstMove $FirstMove) { + $FirstMove = $false if ($PSBoundParameters.ContainsKey('Top') -and $Top -eq $recordCount) { break } @@ -125,13 +111,6 @@ function Get-DSCPullServerESERecord { $_ } catch {} } - } elseif ($column.Name -in $stringColumns) { - $result."$($column.Name)" = [Microsoft.Isam.Esent.Interop.Api]::RetrieveColumnAsString( - $Connection.SessionId, - $Connection.TableId, - $column.Columnid, - [System.Text.Encoding]::Unicode - ) } elseif ($column.Name -in $boolColumns) { $result."$($column.Name)" = [Microsoft.Isam.Esent.Interop.Api]::RetrieveColumnAsBoolean( $Connection.SessionId, diff --git a/DSCPullServerAdmin/private/Move-DSCPullServerESERecordPosition.ps1 b/DSCPullServerAdmin/private/Move-DSCPullServerESERecordPosition.ps1 new file mode 100644 index 0000000..9a066a6 --- /dev/null +++ b/DSCPullServerAdmin/private/Move-DSCPullServerESERecordPosition.ps1 @@ -0,0 +1,31 @@ +function Move-DSCPullServerESERecordPosition { + [OutputType([bool])] + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + [DSCPullServerESEConnection] $Connection, + + [Parameter(Mandatory)] + [string] $Table, + + [Parameter(Mandatory)] + [bool] $FirstMove + ) + + switch ($Table) { + StatusReport { + if ($FirstMove) { + [Microsoft.Isam.Esent.Interop.Api]::TryMoveLast($Connection.SessionId, $Connection.TableId) + } else { + [Microsoft.Isam.Esent.Interop.Api]::TryMovePrevious($Connection.SessionId, $Connection.TableId) + } + } + default { + if ($FirstMove) { + [Microsoft.Isam.Esent.Interop.Api]::TryMoveFirst($Connection.SessionId, $Connection.TableId) + } else { + [Microsoft.Isam.Esent.Interop.Api]::TryMoveNext($Connection.SessionId, $Connection.TableId) + } + } + } +} diff --git a/DSCPullServerAdmin/tests/Unit/private/Move-DSCPullServerESERecordPosition.tests.ps1 b/DSCPullServerAdmin/tests/Unit/private/Move-DSCPullServerESERecordPosition.tests.ps1 new file mode 100644 index 0000000..e69de29