Created
August 8, 2025 17:34
-
-
Save manciuszz/da294675399b0dbef07573e16ce79ed1 to your computer and use it in GitHub Desktop.
Self-executing latest DDU (Display Driver Uninstaller) tool downloading script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# : | |
| @echo off | |
| powershell /nologo /noprofile /command "&{[ScriptBlock]::Create((cat """%~f0""") -join [Char[]]10).Invoke(@(&{$args}%*))}" | |
| exit /b | |
| #> | |
| Function Get-LatestDDUVersion { | |
| $pageUrl = 'https://www.wagnardsoft.com/display-driver-uninstaller-DDU-' | |
| Write-Host "Fetching latest DDU versions from $pageUrl..." | |
| try { | |
| $resp = Invoke-WebRequest -Uri $pageUrl -UseBasicParsing -ErrorAction Stop | |
| } catch { | |
| Throw "Failed to retrieve DDU page: $_" | |
| } | |
| $versions = foreach ($link in $resp.Links) { | |
| if ($link.outerHTML -match 'DDU\)\s*(\d+\.\d+\.\d+\.\d+)') { | |
| [string]$Matches[1] | |
| } | |
| } | |
| if (-not $versions) { | |
| Throw "No DDU version strings found in links. The page format may have changed." | |
| } | |
| $latest = $versions | Sort-Object -Descending | Select-Object -First 1 | |
| Write-Host "Detected latest DDU version: $latest" | |
| return $latest | |
| } | |
| Function Download-DDU { | |
| param ( | |
| [Parameter(Mandatory = $true)] | |
| [string]$Version, | |
| [Parameter(Mandatory = $false)] | |
| [string]$Destination = (Get-Location).Path | |
| ) | |
| $fileName = "DDU v$Version.exe" | |
| $escapedName = [uri]::EscapeDataString($fileName) | |
| $downloadUrl = "https://www.wagnardsoft.com/DDU/download/$escapedName" | |
| Write-Host "Downloading DDU version $Version..." | |
| Write-Host "URL: $downloadUrl" | |
| $outFile = Join-Path -Path $Destination -ChildPath $fileName | |
| try { | |
| Invoke-WebRequest -Uri $downloadUrl -OutFile $outFile -UseBasicParsing -ErrorAction Stop | |
| Write-Host "Download completed: $outFile" | |
| } catch { | |
| Throw "Download failed: $_" | |
| } | |
| } | |
| $latestVersion = Get-LatestDDUVersion | |
| Download-DDU -Version $latestVersion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment