# === CONFIG === $vlcPath64 = "C:\Program Files\VideoLAN\VLC" $vlcPath32 = "C:\Program Files (x86)\VideoLAN\VLC" $aacsDir1 = "C:\ProgramData\aacs" $aacsDir2 = Join-Path $env:APPDATA "aacs" $tempDir = Join-Path $env:TEMP "vlc_bluray_setup" # --- Auto-elevate --- if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Host "Not running as Administrator. Relaunching with elevation..." -ForegroundColor Yellow Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs exit } Write-Host "=== VLC Blu-ray AACS Auto-Setup ===" -ForegroundColor Cyan Write-Host "Running as Administrator." -ForegroundColor Green Write-Host "Press Enter to continue at each step, or Ctrl+C to abort.`n" pause # --- Step 1: Check VLC installs --- Write-Host "`n[Step 1] Checking VLC installation(s)..." -ForegroundColor Yellow $vlc64found = Test-Path $vlcPath64 $vlc32found = Test-Path $vlcPath32 if ($vlc64found) { Write-Host "Found 64-bit VLC: $vlcPath64" -ForegroundColor Green } else { Write-Host "64-bit VLC not found at: $vlcPath64" -ForegroundColor DarkGray } if ($vlc32found) { Write-Host "Found 32-bit VLC: $vlcPath32" -ForegroundColor Green } else { Write-Host "32-bit VLC not found at: $vlcPath32" -ForegroundColor DarkGray } if (-not $vlc64found -and -not $vlc32found) { Write-Host "No VLC installation found. Exiting." -ForegroundColor Red pause; exit } pause # --- Step 2: Temp directory --- Write-Host "`n[Step 2] Creating temp working directory..." -ForegroundColor Yellow if (!(Test-Path $tempDir)) { New-Item -ItemType Directory -Path $tempDir | Out-Null } Write-Host "Temp dir ready: $tempDir" -ForegroundColor Green pause # --- Step 3: AACS directories --- Write-Host "`n[Step 3] Creating AACS config directories..." -ForegroundColor Yellow foreach ($dir in @($aacsDir1, $aacsDir2)) { if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path $dir | Out-Null Write-Host "Created: $dir" -ForegroundColor Green } else { Write-Host "Already exists: $dir" -ForegroundColor Green } } pause # --- Step 4: Download libaacs.dll 64-bit --- Write-Host "`n[Step 4] Downloading libaacs.dll (64-bit)..." -ForegroundColor Yellow $dll64Dest = Join-Path $tempDir "libaacs64.dll" $dll64Url = "https://vlc-bluray.whoknowsmy.name/files/win64/libaacs.dll" Write-Host "URL: $dll64Url" try { Invoke-WebRequest -Uri $dll64Url -OutFile $dll64Dest -UseBasicParsing Write-Host "Downloaded ($((Get-Item $dll64Dest).Length) bytes)" -ForegroundColor Green } catch { Write-Host "Failed: $_" -ForegroundColor Red pause; exit } pause # --- Step 5: Download libaacs.dll 32-bit --- Write-Host "`n[Step 5] Downloading libaacs.dll (32-bit)..." -ForegroundColor Yellow $dll32Dest = Join-Path $tempDir "libaacs32.dll" $dll32Url = "https://vlc-bluray.whoknowsmy.name/files/win32/libaacs.dll" Write-Host "URL: $dll32Url" try { Invoke-WebRequest -Uri $dll32Url -OutFile $dll32Dest -UseBasicParsing Write-Host "Downloaded ($((Get-Item $dll32Dest).Length) bytes)" -ForegroundColor Green } catch { Write-Host "Failed: $_" -ForegroundColor Red pause; exit } pause # --- Step 6: Download KEYDB zip --- Write-Host "`n[Step 6] Downloading KEYDB zip..." -ForegroundColor Yellow # All sources below deliver a ZIP file containing keydb.cfg inside. # Uncomment ONE source at a time. Source 1 is the most up to date. # # Source 1: fvonline-db (most actively updated) $keydbUrl = "http://fvonline-db.bplaced.net/fv_download.php?lang=eng" # # Source 2: vlc-bluray mirror of fvonline-db (same database, alternate host) # $keydbUrl = "https://vlc-aacs.whoknowsmy.name/files/KEYDB.cfg" $keydbZip = Join-Path $tempDir "KEYDB.zip" $keydbDest = Join-Path $tempDir "KEYDB.cfg" Write-Host "URL: $keydbUrl" try { Invoke-WebRequest -Uri $keydbUrl -OutFile $keydbZip -UseBasicParsing Write-Host "Downloaded zip ($((Get-Item $keydbZip).Length) bytes)" -ForegroundColor Green } catch { Write-Host "Failed to download: $_" -ForegroundColor Red pause; exit } pause # --- Step 6b: Extract KEYDB.cfg from zip --- Write-Host "`n[Step 6b] Extracting KEYDB.cfg from zip..." -ForegroundColor Yellow try { Add-Type -AssemblyName System.IO.Compression.FileSystem $zip = [System.IO.Compression.ZipFile]::OpenRead($keydbZip) $entry = $zip.Entries | Where-Object { $_.Name -ilike "keydb.cfg" } if ($null -eq $entry) { Write-Host "keydb.cfg not found inside zip. Contents of zip:" -ForegroundColor Red $zip.Entries | ForEach-Object { Write-Host " - $($_.FullName)" } $zip.Dispose() pause; exit } [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $keydbDest, $true) $zip.Dispose() Write-Host "Extracted KEYDB.cfg ($((Get-Item $keydbDest).Length) bytes)" -ForegroundColor Green } catch { Write-Host "Failed to extract: $_" -ForegroundColor Red pause; exit } pause # --- Step 7: Install libaacs.dll --- Write-Host "`n[Step 7] Installing libaacs.dll to VLC folder(s)..." -ForegroundColor Yellow if ($vlc64found) { try { Copy-Item $dll64Dest -Destination "$vlcPath64\libaacs.dll" -Force Write-Host "Confirmed 64-bit: $vlcPath64\libaacs.dll" -ForegroundColor Green } catch { Write-Host "Failed to copy 64-bit dll: $_" -ForegroundColor Red } } if ($vlc32found) { try { Copy-Item $dll32Dest -Destination "$vlcPath32\libaacs.dll" -Force Write-Host "Confirmed 32-bit: $vlcPath32\libaacs.dll" -ForegroundColor Green } catch { Write-Host "Failed to copy 32-bit dll: $_" -ForegroundColor Red } } pause # --- Step 8: Install KEYDB.cfg to both locations --- Write-Host "`n[Step 8] Installing KEYDB.cfg to both AACS locations..." -ForegroundColor Yellow foreach ($dir in @($aacsDir1, $aacsDir2)) { try { Copy-Item $keydbDest -Destination "$dir\KEYDB.cfg" -Force Write-Host "Confirmed: $dir\KEYDB.cfg ($((Get-Item "$dir\KEYDB.cfg").Length) bytes)" -ForegroundColor Green } catch { Write-Host "Failed to copy to ${dir}: $_" -ForegroundColor Red } } pause # --- Step 9: Cleanup --- Write-Host "`n[Step 9] Cleaning up temp files..." -ForegroundColor Yellow Remove-Item $tempDir -Recurse -Force Write-Host "Temp folder removed." -ForegroundColor Green pause Write-Host "`n=== All Done ===" -ForegroundColor Cyan Write-Host "libaacs.dll (64-bit) -> $vlcPath64" Write-Host "libaacs.dll (32-bit) -> $vlcPath32" Write-Host "KEYDB.cfg -> $aacsDir1" Write-Host "KEYDB.cfg -> $aacsDir2" Write-Host "`nRestart VLC and try your Blu-ray again." pause