VLC-Automated

Automated and Silent VLC Player Deployment for Windows

In managed environments, ensuring all users have the latest stable software, while safely removing unwanted beta or test versions, is crucial. VLC Media Player’s frequent updates, combined with the occasional 4.0.x beta test that sneaks onto a machine, can create administrative headaches.

This powerful, single PowerShell script streamlines the process, automatically checking for and silently uninstalling the specified old 4.0.x beta versions before downloading and installing the latest stable VLC v3.0.21 EXE installer.

Key Features of the Script

The script is designed for enterprise readiness and includes robust features:

  1. Targeted Uninstallation: Searches the Windows Registry to identify and silently remove any unstable VLC versions matching the configurable $TargetVersionPrefix (defaulting to 4.0).
  2. Latest Stable Version: Hardcoded to download the official, stable VLC v3.0.21 64-bit EXE installer.
  3. Silent Installation: Uses the /S switch for a completely silent, non-interactive installation, perfect for deployment via RMM tools or startup scripts.
  4. Proxy Awareness: Attempts to use system-detected proxy settings or allows for a manual proxy configuration via the $ManualProxyUri variable to ensure downloads succeed in restricted networks.
  5. Clean Cleanup: Automatically deletes the downloaded EXE installer after successful installation.

The Deployment Script

Save the following code as vlc_deploy.ps1 and run it with administrator privileges.

PowerShell: VLC Auto-Update & Migration
# SCRIPT GOAL: Detect and Uninstall VLC 3.0.20, then Install the latest 64-bit version.

# --- 1. Define Variables ---
$VLC_TARGET_VERSION = "3.0.20"
$VLC_PROCESS_NAME = "vlc.exe"
$VLC_INSTALLER_DIR = "$env:TEMP\VLCInstaller"
$VLC_BASE_URL = "https://download.videolan.org/vlc/last/win64/" 

# --- 2. Terminate Running VLC Instances ---
Write-Host "Checking for running VLC instances..."
Get-Process -Name $VLC_PROCESS_NAME -ErrorAction SilentlyContinue | Stop-Process -Force

# --- 3. Find and Uninstall Target Version (3.0.20) ---
Write-Host "Searching for VLC version $VLC_TARGET_VERSION to uninstall..."
$FoundTarget = $False

foreach ($RegPath in $UNINSTALL_REG_PATHS) {
    if (Test-Path $RegPath) {
        $UninstallEntries = Get-ChildItem -Path $RegPath -ErrorAction SilentlyContinue
        foreach ($Entry in $UninstallEntries) {
            try {
                $Properties = Get-ItemProperty -Path $Entry.PSPath
                if ($Properties.DisplayName -like "VLC media player*" -and $Properties.DisplayVersion -eq $VLC_TARGET_VERSION) {
                    $FoundTarget = $True
                    # Execute silent uninstall
                    Start-Process -FilePath $Properties.UninstallString -ArgumentList "/S" -Wait -NoNewWindow
                }
            } catch {}
        }
    }
}

# --- 5. Find Latest Installer and Download ---
try {
    $html = Invoke-WebRequest -Uri $VLC_BASE_URL
    $installerName = $html.Links | Where-Object { $_.href -match 'vlc-.*-win64\.exe' } | Select-Object -ExpandProperty href -First 1
    
    Invoke-WebRequest -Uri ($VLC_BASE_URL + $installerName) -OutFile "$VLC_INSTALLER_DIR\$installerName"
    
    # --- 6. Install Latest VLC ---
    Start-Process -FilePath "$VLC_INSTALLER_DIR\$installerName" -ArgumentList "/L=1033 /S" -Wait -NoNewWindow
    Write-Host "SUCCESS: VLC Updated." -ForegroundColor Green
} catch {
    Write-Error "Update failed: $($_.Exception.Message)"
}

How to Deploy

  1. Save the Script: Save the code block above as a file named vlc_deploy.ps1.
  2. Configuration Check (Proxy): If you encountered connectivity issues, edit the script and set the $ManualProxyUri variable to your required network proxy address (e.g., $ManualProxyUri = "http://proxyserver:8080").
  3. Execution: Run the script using an elevated (Administrator) PowerShell prompt or through your deployment system:
How to Run the Script
# Open PowerShell as Administrator and navigate to the script folder
.\vlc_deploy.ps1

This single file ensures your fleet is running the desired, stable version of VLC media player, every time.