Загрузка данных


& {
    $dir = Join-Path $env:ProgramData 'NVIDIA Corporation\Drs'

    Get-ChildItem -LiteralPath $dir -File -Force -ErrorAction Stop |
        Where-Object {
            $_.Name -match '^(nvAppTimestamps\d*|nvdrsdb\d+\.bin)$'
        } |
        ForEach-Object {
            $f = $_

            try {
                $raw = [Text.Encoding]::ASCII.GetString(
                    [IO.File]::ReadAllBytes($f.FullName)
                )

                [pscustomobject]@{
                    File = $f.Name
                    C_UTF16 = [regex]::Matches(
                        $raw, '[Cc]\x00:\x00\\\x00'
                    ).Count
                    D_UTF16 = [regex]::Matches(
                        $raw, '[Dd]\x00:\x00\\\x00'
                    ).Count
                    C_Text = [regex]::Matches(
                        $raw, '[Cc]:\\'
                    ).Count
                    D_Text = [regex]::Matches(
                        $raw, '[Dd]:\\'
                    ).Count
                }
            }
            catch {
                Write-Warning (
                    $f.Name + ': ' + $_.Exception.Message
                )
            }
        } |
        Format-Table -AutoSize
}