forked from VirtualDrivers/Virtual-Display-Driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsilent-install.ps1
More file actions
70 lines (60 loc) · 2.75 KB
/
silent-install.ps1
File metadata and controls
70 lines (60 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
[CmdletBinding()]
param(
# SHA256 hash of the DevCon binary to install
# Possible values can be found at:
# https://github.com/Drawbackz/DevCon-Installer/blob/master/devcon_sources.json
# Look for the "sha256" field in the JSON for valid hash values
[Parameter(Mandatory=$true)]
[string]$DevconHash,
# Latest stable version of VDD
[Parameter(Mandatory=$false)]
[string]$DriverVersion = "latest"
)
# Create temp directory
$tempDir = Join-Path $env:TEMP "VDDInstall"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
# Download and run DevCon Installer
Write-Host "Installing DevCon..." -ForegroundColor Cyan
$devconPath = Join-Path $tempDir "Devcon.Installer.exe"
Invoke-WebRequest -Uri "https://github.com/Drawbackz/DevCon-Installer/releases/download/1.4-rc/Devcon.Installer.exe" -OutFile $devconPath
Start-Process -FilePath $devconPath -ArgumentList "install -hash $DevconHash -update -dir `"$tempDir`"" -Wait -NoNewWindow
# Define path to devcon executable
$devconExe = Join-Path $tempDir "devcon.exe"
# Handle driver download
if ($DriverVersion -eq "latest") {
Write-Host "Determining latest driver version..." -ForegroundColor Cyan
$apiUrl = "https://api.github.com/repos/VirtualDrivers/Virtual-Display-Driver/releases/latest"
$headers = @{
"Accept" = "application/vnd.github.v3+json"
"User-Agent" = "PowerShell-VDDInstaller"
}
try {
$releaseInfo = Invoke-RestMethod -Uri $apiUrl -Headers $headers
$latestVersion = $releaseInfo.tag_name
# Look for the x64 zip asset
$asset = $releaseInfo.assets | Where-Object { $_.name -match "x64\.zip$" } | Select-Object -First 1
if ($asset) {
$downloadUrl = $asset.browser_download_url
Write-Host "Found latest version: $latestVersion" -ForegroundColor Cyan
} else {
throw "Could not find x64 driver package in latest release"
}
} catch {
Write-Host "Error fetching latest release information: $_" -ForegroundColor Red
exit 1
}
} else {
# Use specified version
$downloadUrl = "https://github.com/VirtualDrivers/Virtual-Display-Driver/releases/download/$DriverVersion/Signed-Driver-v$DriverVersion-x64.zip"
}
# Download and extract driver package
Write-Host "Downloading driver from: $downloadUrl" -ForegroundColor Cyan
$driverZipPath = Join-Path $tempDir "driver.zip"
Invoke-WebRequest -Uri $downloadUrl -OutFile $driverZipPath
Expand-Archive -Path $driverZipPath -DestinationPath $tempDir -Force
# Install the driver
Write-Host "Installing virtual display driver..." -ForegroundColor Cyan
Push-Location $tempDir
& $devconExe install .\MttVDD.inf "Root\MttVDD"
Pop-Location
Write-Host "Driver installation completed." -ForegroundColor Green