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