Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Fix.ps1
- # Ableton Live - MSVCR120.dll missing (VC++ 2013)
- # Flow: check -> winget install x64+x86 -> recheck -> open Microsoft pages -> optional DISM/SFC -> copy DLLs -> launch test
- # Launch : powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Users\...\Fix.ps1"
- $ErrorActionPreference = 'Stop'
- # -------- Logging (ASCII only) --------
- function LogLine { Write-Host "------------------------------------------------------------------------" }
- function Stamp { (Get-Date).ToString('yyyy-MM-dd HH:mm:ss') }
- function LOG ([string]$m) { Write-Host ("[{0}] [INFO] {1}" -f (Stamp), $m) }
- function OK ([string]$m) { Write-Host ("[{0}] [ OK ] {1}" -f (Stamp), $m) -ForegroundColor Green }
- function WARN ([string]$m) { Write-Host ("[{0}] [WARN] {1}" -f (Stamp), $m) -ForegroundColor Yellow }
- function ERR ([string]$m) { Write-Host ("[{0}] [ERR ] {1}" -f (Stamp), $m) -ForegroundColor Red }
- # -------- Elevate if needed --------
- $me = [Security.Principal.WindowsIdentity]::GetCurrent()
- $pp = New-Object Security.Principal.WindowsPrincipal($me)
- if (-not $pp.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
- Start-Process -Verb RunAs -FilePath "powershell.exe" -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
- exit
- }
- # TLS 1.2 just in case
- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- # -------- Locate Ableton --------
- function Get-AbletonPath {
- $cands = @(
- "C:\Program Files\Ableton\Live 11 Suite\Program",
- "C:\Program Files\Ableton\Live 11 Standard\Program",
- "C:\Program Files\Ableton\Live 11 Intro\Program",
- "C:\Program Files\Ableton\Live 12 Suite\Program"
- )
- foreach ($p in $cands) {
- if (Test-Path $p) { return $p }
- }
- return "C:\Program Files\Ableton\Live 11 Suite\Program"
- }
- $Ableton = Get-AbletonPath
- LOG ("Ableton folder: {0}" -f $Ableton)
- # -------- DLL checks --------
- $sys64 = "$env:WINDIR\System32"
- $sys32 = "$env:WINDIR\SysWOW64"
- function Has-VC2013 {
- [PSCustomObject]@{
- X64 = (Test-Path "$sys64\MSVCR120.dll") -and (Test-Path "$sys64\MSVCP120.dll")
- X86 = (Test-Path "$sys32\MSVCR120.dll") -and (Test-Path "$sys32\MSVCP120.dll")
- }
- }
- function Print-State([object]$s) {
- if ($s.X64) { OK "VC++ 2013 x64 present (System32)" } else { WARN "VC++ 2013 x64 missing" }
- if ($s.X86) { OK "VC++ 2013 x86 present (SysWOW64)" } else { WARN "VC++ 2013 x86 missing" }
- }
- LogLine
- LOG "Initial check for VC++ 2013 (MSVCR120/MSVCP120)"
- LogLine
- $state = Has-VC2013
- Print-State $state
- if ($state.X64 -and $state.X86) {
- OK "All runtimes already present. You can try Ableton now."
- exit 0
- }
- # -------- Try winget install --------
- function Install-WithWinget {
- if (Get-Command winget -ErrorAction SilentlyContinue) {
- try {
- LOG "winget install VC++ 2013 x64"
- winget install --id "Microsoft.VC++2013Redist-x64" -e --silent --accept-package-agreements --accept-source-agreements | Out-Null
- } catch {
- WARN ("winget x64 failed: {0}" -f $_.Exception.Message)
- }
- try {
- LOG "winget install VC++ 2013 x86"
- winget install --id "Microsoft.VC++2013Redist-x86" -e --silent --accept-package-agreements --accept-source-agreements | Out-Null
- } catch {
- WARN ("winget x86 failed: {0}" -f $_.Exception.Message)
- }
- } else {
- WARN "winget not available (App Installer missing)"
- }
- }
- LogLine
- LOG "Attempt install via winget"
- LogLine
- Install-WithWinget
- LogLine
- LOG "Recheck after winget"
- LogLine
- $state = Has-VC2013
- Print-State $state
- # -------- Manual Microsoft install if still missing --------
- if (-not ($state.X64 -and $state.X86)) {
- LogLine
- WARN "Automatic install did not complete. Opening Microsoft pages..."
- LogLine
- Start-Process "https://www.microsoft.com/download/details.aspx?id=40784"
- Start-Process "https://learn.microsoft.com/visualstudio/releases/2013/redistribution"
- Write-Host ""
- Write-Host ">>> Download and install BOTH files: vcredist_x64.exe THEN vcredist_x86.exe." -ForegroundColor Yellow
- Write-Host ">>> When done, press ENTER here to continue..." -ForegroundColor Yellow
- [void][System.Console]::ReadLine()
- LogLine
- LOG "Recheck after manual install"
- LogLine
- $state = Has-VC2013
- Print-State $state
- }
- # -------- Optional repair if still missing --------
- if (-not ($state.X64 -and $state.X86)) {
- LogLine
- WARN "Still missing. Running DISM and SFC repair (can take time)"
- LogLine
- Start-Process "cmd.exe" -ArgumentList "/c DISM /Online /Cleanup-Image /RestoreHealth" -Wait
- Start-Process "cmd.exe" -ArgumentList "/c sfc /scannow" -Wait
- LogLine
- LOG "Recheck after DISM/SFC"
- LogLine
- $state = Has-VC2013
- Print-State $state
- }
- # -------- Fallback: copy DLLs beside Ableton (if x64 available) --------
- if ($state.X64) {
- try {
- Copy-Item "$sys64\MSVCR120.dll" "$Ableton\MSVCR120.dll" -Force
- Copy-Item "$sys64\MSVCP120.dll" "$Ableton\MSVCP120.dll" -Force
- OK "Copied x64 DLLs into Ableton folder (fallback)"
- } catch {
- WARN ("Copy fallback failed: {0}" -f $_.Exception.Message)
- }
- }
- # -------- Launch Ableton test --------
- $exeCandidates = @(
- "$Ableton\Ableton Live 11 Suite.exe",
- "$Ableton\Ableton Live 12 Suite.exe"
- )
- $exe = $exeCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
- LogLine
- LOG "Summary"
- LogLine
- Print-State $state
- if ($exe) {
- LOG ("Launching Ableton: {0}" -f $exe)
- Start-Process -FilePath $exe
- OK "If the popup is gone, you are fixed"
- } else {
- WARN ("Ableton executable not found in: {0}" -f $Ableton)
- }
- if ($state.X64 -and $state.X86) { exit 0 } else { exit 2 }
Advertisement
Add Comment
Please, Sign In to add comment