Files
claudetools/clients/valleywide/app-modernization/source-analysis/scan_vhdx.ps1
Mike Swanson 9a2a05e3cb feat(valleywide): drive 3 deep dive - VWP1.VHDX mount + 97-Server\VWP2 grab
Drive 3 yielded the biggest finds in the project so far.

VHDX mount + scan (D:\WIN7-Orders\Darv-2\VWP1.VHDX, 117 GB Hyper-V disk):
- Mounted read-only as F:, scanned in 85s, dismounted
- NOT Darv's dev box - it's the office "owner" admin workstation
- No newer source code found inside, but:
  - Vwp11.mdb (2023-07-27, 369 MB) - NEWEST DB snapshot anywhere
  - Vwp.mdb (2022-12-23, 769 MB) - on Desktop\Darv VWP
  - Orders Versions/ desktop folder with 2 EXEs + 7 shortcuts
  - The .lnk shortcuts all pointed to G:\VWP2\Orders*.exe - the
    "Aha!" that revealed where Darv's iteration happened
- Saved to source-code/from-VHDX-VWP1/

The VWP2 grab (D:\97-Server-G-Drive\g$ 2024-04-10\VWP2\):
- This is Darv's actual iteration workspace on the production
  Orders server (G: drive)
- 16.36 GB total, 1,061 files. Grabbed 886 files (~893 MB) filtered to
  *.exe, *.rpt, *.ocx, and VB6 source extensions:
  - 64 Orders*.exe versions - complete iteration history (includes the
    production Orders_10A.exe + Orders_10Z.exe variant + dozens more
    with Darv's "iterate-and-rename" naming pattern)
  - 820 Crystal Reports (.rpt)
  - 2 .ocx supporting controls
- Skipped 23 historical .mdb backups (15.8 GB) - we already have
  newer snapshots from 000_ASource and VHDX
- Skipped 6 large subfolders (HOLD, HHOLD, Pay_2021_0325, GWAC,
  20220205, 20211010 RPT) - mostly more MDBs
- Saved to source-code/from-VWP2-97server/

What we learned about the 4-year gap:
- No source code newer than 2020-06-09 ORDERS_C.vbp baseline found
  on any of the three rotation drives
- The 64 EXE versions in VWP2 go through 2022 - Darv was iterating
  and rebuilding compiled output but not updating his .vbp source
  control. This is consistent with his "rename and try" workflow
- The production exe (Orders_10A.exe) is in this batch - now we can
  use VB Decompiler Pro on it without needing the original drive

Helper scripts:
- scan_vhdx.ps1 - fast PowerShell scan of a mounted VHDX for source/DB
- find_vwp2.py - cross-CSV search for the VWP2 path
- vwp2_summary.py - size+type breakdown of the VWP2 folder
- debug_vwp2.py - one-off debug helper

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 18:02:47 -07:00

86 lines
3.8 KiB
PowerShell

# Fast scan of mounted VWP1.VHDX for source-of-interest files.
$ErrorActionPreference = 'SilentlyContinue'
$root = 'F:\'
$wantExts = @{
'.vbp'=1; '.vbg'=1; '.vbw'=1; '.frm'=1; '.bas'=1; '.cls'=1; '.ctl'=1;
'.scc'=1; '.mdb'=1
}
$wantFilenames = @{
'srcsafe.ini'=1; 'ss.ini'=1; 'ssadmin.exe'=1; 'analyze.exe'=1
}
$cutoff = [DateTime]'2020-06-09'
$results = New-Object System.Collections.Generic.List[object]
$darvFolders = New-Object System.Collections.Generic.List[string]
$fileCount = 0
$start = Get-Date
$stack = New-Object System.Collections.Generic.Stack[string]
$stack.Push($root)
while ($stack.Count -gt 0) {
$dir = $stack.Pop()
$leaf = Split-Path $dir -Leaf
if ($leaf -ieq 'Windows' -or $leaf -ieq 'WinSxS' -or $leaf -ieq '$Recycle.Bin' -or $leaf -ieq 'System Volume Information') {
# Don't descend into Windows-internal noise
# But DO record if name matches darv/source/vwp/orders/vss
if ($leaf -imatch 'darv|sourcesafe|vss') {
$darvFolders.Add($dir)
}
continue
}
if ($leaf -imatch 'darv|sourcesafe|vss|orders|vwp') {
$darvFolders.Add($dir)
}
try {
foreach ($f in [System.IO.Directory]::EnumerateFiles($dir)) {
$fileCount++
$name = [System.IO.Path]::GetFileName($f).ToLower()
$ext = [System.IO.Path]::GetExtension($name)
if ($wantExts.ContainsKey($ext) -or $wantFilenames.ContainsKey($name)) {
try {
$fi = [System.IO.FileInfo]::new($f)
$results.Add([pscustomobject]@{
Ext = $ext
Name = $name
Modified = $fi.LastWriteTime
SizeKB = [math]::Round($fi.Length/1KB, 1)
Path = $f
}) | Out-Null
} catch {}
}
}
} catch {}
try {
foreach ($sub in [System.IO.Directory]::EnumerateDirectories($dir)) {
$stack.Push($sub)
}
} catch {}
}
$elapsed = (Get-Date) - $start
Write-Host "[INFO] Scanned $fileCount files in $([math]::Round($elapsed.TotalSeconds,1))s"
Write-Host "[INFO] Found $($results.Count) source-of-interest files, $($darvFolders.Count) Darv/SourceSafe/Orders/VWP folders"
Write-Host ""
# Surface findings
Write-Host "=== Folders matching darv/sourcesafe/vss/orders/vwp on this VHDX ==="
$darvFolders | Select-Object -Unique | Sort-Object | ForEach-Object { Write-Host $_ }
Write-Host ""
Write-Host "=== .vbp / .frm / .bas / .cls / .ctl files NEWER than 2020-06-09 ==="
$results | Where-Object { $_.Modified -gt $cutoff -and ('.vbp','.vbg','.vbw','.frm','.bas','.cls','.ctl') -contains $_.Ext } | Sort-Object Modified -Descending | Select-Object -First 50 | Format-Table Modified, SizeKB, Path -AutoSize | Out-String -Width 220 | Write-Host
Write-Host "=== srcsafe.ini / ss.ini (SourceSafe repository roots) ==="
$results | Where-Object { $_.Name -in @('srcsafe.ini','ss.ini') } | Format-Table Modified, SizeKB, Path -AutoSize | Out-String -Width 220 | Write-Host
Write-Host "=== ALL .vbp files (any date) ==="
$results | Where-Object { $_.Ext -eq '.vbp' } | Sort-Object Modified -Descending | Select-Object -First 50 | Format-Table Modified, SizeKB, Path -AutoSize | Out-String -Width 220 | Write-Host
Write-Host "=== .mdb files (database snapshots) ==="
$results | Where-Object { $_.Ext -eq '.mdb' } | Sort-Object Modified -Descending | Select-Object -First 30 | Format-Table Modified, SizeKB, Path -AutoSize | Out-String -Width 220 | Write-Host
# Save full results to CSV for the record
$outCsv = 'C:\Users\guru\ClaudeTools\clients\valleywide\app-modernization\source-analysis\drive3-2026-05-16\VHDX-scan-VWP1.csv'
$results | Sort-Object Modified -Descending | Export-Csv -Path $outCsv -NoTypeInformation -Encoding UTF8
Write-Host "[OK] Full results written to $outCsv"