Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b4aac65
Update WinToolkit-template.ps1
Magnetarman May 22, 2026
78489a7
Create AutoVideoDriverInstall.ps1
Magnetarman May 22, 2026
c0fe317
Create VideoDriverReinstall.ps1
Magnetarman May 22, 2026
db163e2
Update VideoDriverInstall.ps1
Magnetarman May 22, 2026
69cdc7f
Update WinToolkit-template.ps1
Magnetarman May 22, 2026
28426f6
Create DriverOverrides.json
Magnetarman May 22, 2026
9c9b323
Update AutoVideoDriverInstall.ps1
Magnetarman May 22, 2026
72d6711
Update VideoDriverReinstall.ps1
Magnetarman May 22, 2026
be23eee
Update WinToolkit-template.ps1
Magnetarman May 22, 2026
32772ed
Update GamingToolkit.ps1
Magnetarman May 22, 2026
f3d0caa
Delete VideoDriverInstall.ps1
Magnetarman May 22, 2026
f07e101
Delete VideoDriver.Tests.ps1
Magnetarman May 22, 2026
5988f5a
Update GamingToolkit.ps1
Magnetarman May 22, 2026
8c581cd
Fix: Correggi verifica default parameter CountdownSeconds nel test Ga…
Magnetarman May 22, 2026
11dfc1d
✅ Compilato WinToolkit vSviluppo in Corso
Magnetarman May 22, 2026
76bbe14
Delete AMD-Autodetect.exe
Magnetarman May 22, 2026
5207a0f
Update WinToolkit-template.ps1
Magnetarman May 22, 2026
c08f3be
✅ Compilato WinToolkit vSviluppo in Corso
Magnetarman May 22, 2026
7c5d67a
Update WinToolkit-template.ps1
Magnetarman May 22, 2026
54efda7
Update AutoVideoDriverInstall.ps1
Magnetarman May 22, 2026
7396627
Update VideoDriverReinstall.ps1
Magnetarman May 22, 2026
c51fd3e
✅ Compilato WinToolkit vSviluppo in Corso
Magnetarman May 22, 2026
67e439d
Update AutoVideoDriverInstall.ps1
Magnetarman May 22, 2026
7880dec
Update VideoDriverReinstall.ps1
Magnetarman May 22, 2026
4fc6dad
✅ Compilato WinToolkit vSviluppo in Corso
Magnetarman May 22, 2026
e9eaff4
Update AutoVideoDriverInstall.ps1
Magnetarman May 22, 2026
555eeef
Update VideoDriverReinstall.ps1
Magnetarman May 22, 2026
123cb24
Update WinToolkit-template.ps1
Magnetarman May 22, 2026
bd24119
✅ Compilato WinToolkit vSviluppo in Corso
Magnetarman May 22, 2026
4d976ed
Merge branch 'Dev' into ENHANCEMENT-Upgrade-Video-Driver-Install-Script
Magnetarman May 22, 2026
3e64c9d
✅ Compilato WinToolkit vSviluppo in Corso
Magnetarman May 22, 2026
d479a21
✅ Compilato WinToolkit vSviluppo in Corso
Magnetarman May 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/tests/Unit/GamingToolkit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ Describe 'GamingToolkit — Firma' {
}

It '-CountdownSeconds deve avere valore di default 30' {
$default = (Get-Command GamingToolkit).Parameters['CountdownSeconds'].DefaultValue
$default | Should -Be 30
# Verifica leggendo il sorgente, poiché .DefaultValue non funziona con definizioni semplici
$source = Get-Content -Path $script:ToolPath -Raw
$source | Should -Match '\[int\]\$CountdownSeconds\s*=\s*30'
}
}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/CI_UpdateWinToolkit_Dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ jobs:
$config.Run.Path = @(
'.github/tests/WinToolkit.Tests.ps1',
'.github/tests/Unit'
'.github/tests/Integration'
)
$config.Run.PassThru = $true
$config.Output.Verbosity = 'Detailed'
Expand All @@ -474,7 +475,7 @@ jobs:
} catch {
Write-Host "⚠️ Pester execution encountered an error: $($_.Exception.Message)" -ForegroundColor Yellow
Write-Host "Retrying without code coverage..." -ForegroundColor Yellow

$config.CodeCoverage.Enabled = $false
$result = Invoke-Pester -Configuration $config
}
Expand Down
9 changes: 6 additions & 3 deletions WinToolkit-template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,10 @@ function Invoke-ToolkitDownload {
if ($totalBytes -gt 0 -and -not $Global:GuiSessionActive) {
$percent = [Math]::Round(($totalRead / $totalBytes) * 100)
if ($percent -ne $lastPercent) {
$filled = '█' * [Math]::Floor($percent * 30 / 100)
$empty = '░' * (30 - $filled.Length)
$bar = "[$filled$empty] {0,3}%" -f $percent

# Convertire bytes in KB/MB appropriato
$currentDisplay = if ($totalRead -gt 1048576) {
"$([Math]::Round($totalRead / 1048576, 1)) MB"
Expand All @@ -943,8 +947,7 @@ function Invoke-ToolkitDownload {
"$([Math]::Round($totalBytes / 1024, 1)) KB"
}

Clear-ProgressLine
Show-ProgressBar -Activity "Download $Description" -Status "($currentDisplay / $totalDisplay)" -Percent $percent -Icon '📥' -Color 'Cyan'
Write-Host "`r⏳ Download $Description $bar ($currentDisplay / $totalDisplay)" -NoNewline -ForegroundColor Cyan
$lastPercent = $percent
}
}
Expand All @@ -959,7 +962,7 @@ function Invoke-ToolkitDownload {
$handler.Dispose()

if (Test-Path $OutputPath) {
if (-not $Global:GuiSessionActive) { Clear-ProgressLine; Write-Host "" }
if (-not $Global:GuiSessionActive) { Write-Host "" }
Write-StyledMessage -Type 'Success' -Text "✅ Download completato: $Description."
return $true
}
Expand Down
833 changes: 493 additions & 340 deletions WinToolkit.ps1

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions asset/DriverOverrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"Key": "AMD_RX_580",
"Manufacturer": "AMD",
"NamePattern": "RX 580|RX-580|Radeon RX 580",
"PnpIdPattern": "PCI\\VEN_1002&DEV_67DF*",
"DownloadUrl": "https://drivers.amd.com/drivers/whql-amd-software-adrenalin-edition-23.8.2-win10-win11-aug31.exe",
"FileName": "AMD-RX580-23.8.2-WHQL.exe",
"DisplayName": "AMD RX 580 Stable Driver (23.8.2 WHQL)"
}
]
91 changes: 48 additions & 43 deletions tool/AutoVideoDriverInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,71 +13,76 @@ function AutoVideoDriverInstall {

Start-ToolkitSession -ToolName "AutoVideoDriverInstall" -SubTitle "Auto Video Driver Install"

$driverToolsPath = $AppConfig.Paths.Drivers

function Get-GpuManufacturer {
$pnpDevices = Get-PnpDevice -Class Display -ErrorAction SilentlyContinue
if (-not $pnpDevices) {
Write-StyledMessage -Type 'Warning' -Text "Nessun dispositivo display PnP rilevato."
return 'Unknown'
}
foreach ($device in $pnpDevices) {
$name = $device.FriendlyName
$mfr = $device.Manufacturer
if ($name -match 'NVIDIA|GeForce|Quadro|Tesla' -or $mfr -match 'NVIDIA') { return 'NVIDIA' }
if ($name -match 'AMD|Radeon|ATI' -or $mfr -match 'AMD|ATI') { return 'AMD' }
if ($name -match 'Intel|Iris|UHD|HD Graphics' -or $mfr -match 'Intel') { return 'Intel' }
}
return 'Unknown'
}
$desktopPath = $AppConfig.Paths.Desktop

function Set-BlockWindowsUpdateDrivers {
Write-StyledMessage -Type 'Info' -Text "Blocco driver automatici da Windows Update."
try {
Set-RegistryValue -Path $AppConfig.Registry.WindowsUpdatePolicies -Name "ExcludeWUDriversInQualityUpdate" -Value 1
Write-StyledMessage -Type 'Success' -Text "Blocco WU driver impostato."
$gpupdateResult = Invoke-WithSpinner -Activity "Aggiornamento criteri di gruppo" -Command 'gpupdate.exe' -Arguments '/force' -LogContextKey "Video-GPUpdate"
if ($gpupdateResult.ExitCode -eq 0) {
Write-StyledMessage -Type 'Success' -Text "Criteri di gruppo aggiornati."
$gpupdateResult = Invoke-WithSpinner -Activity "Aggiornamento criteri di gruppo (può impiegare 1-2 minuti)" -Command 'gpupdate.exe' -Arguments '/force' -LogContextKey "Video-GPUpdate" -TimeoutSeconds 180
if ($gpupdateResult -and $gpupdateResult.ExitCode -eq 0) {
Write-StyledMessage -Type 'Success' -Text "✅ Criteri di gruppo aggiornati."
}
elseif ($gpupdateResult) {
Write-StyledMessage -Type 'Warning' -Text "⚠️ gpupdate completato con codice: $($gpupdateResult.ExitCode). Proseguo comunque."
}
else {
Write-StyledMessage -Type 'Warning' -Text "gpupdate completato con codice: $($gpupdateResult.ExitCode)."
Write-StyledMessage -Type 'Warning' -Text "⚠️ gpupdate non ha risposto. Proseguo comunque."
}
}
catch {
Write-StyledMessage -Type 'Warning' -Text "Errore blocco WU driver: $($_.Exception.Message)."
Write-StyledMessage -Type 'Warning' -Text "⚠️ Errore blocco WU driver: $($_.Exception.Message). Proseguo comunque."
}
}

try {
Write-StyledMessage -Type 'Info' -Text "🚀 Avvio installazione automatica driver video."
Set-BlockWindowsUpdateDrivers

$gpuManufacturer = Get-GpuManufacturer

Write-StyledMessage -Type 'Info' -Text "🔍 Rilevamento configurazione GPU in corso..."
$gpuAnalysis = VcardAnalizer
$gpuManufacturer = $gpuAnalysis.PrimaryManufacturer
Write-StyledMessage -Type 'Info' -Text "GPU rilevata: $gpuManufacturer."

switch ($gpuManufacturer) {
'AMD' {
$amdPath = Join-Path $driverToolsPath "AMD-Autodetect.exe"
if (Invoke-ToolkitDownload -Uri $AppConfig.URLs.AMDInstaller -OutputPath $amdPath -Description "AMD Auto-Detect Tool") {
Write-StyledMessage -Type 'Info' -Text "Avvio installer AMD. Chiudi il terminale al termine dell'installazione."
$null = Invoke-WithSpinner -Activity "Esecuzione installer AMD" -Command $amdPath -LogContextKey "Video-Install-AMD"
Write-StyledMessage -Type 'Success' -Text "Installazione driver AMD completata."
$stableDownloadDone = $false
if ($gpuAnalysis.Matches.Count -gt 0) {
foreach ($match in $gpuAnalysis.Matches) {
if ([string]::IsNullOrWhiteSpace($match.DownloadUrl)) { continue }
$targetName = if (-not [string]::IsNullOrWhiteSpace($match.FileName)) { $match.FileName } else { "$($match.Key).exe" }
$targetPath = Join-Path $desktopPath $targetName
$displayName = if (-not [string]::IsNullOrWhiteSpace($match.DisplayName)) { $match.DisplayName } else { $match.Key }

if (Invoke-ToolkitDownload -Uri $match.DownloadUrl -OutputPath $targetPath -Description $displayName) {
Write-StyledMessage -Type 'Success' -Text "Driver stabile scaricato sul desktop: $displayName"
$stableDownloadDone = $true
}
}
'NVIDIA' {
$nvidiaPath = Join-Path $driverToolsPath "NVCleanstall_1.19.0.exe"
if (Invoke-ToolkitDownload -Uri $AppConfig.URLs.NVCleanstall -OutputPath $nvidiaPath -Description "NVCleanstall") {
Write-StyledMessage -Type 'Info' -Text "Avvio NVCleanstall. Chiudi il terminale al termine dell'installazione."
$null = Invoke-WithSpinner -Activity "Esecuzione NVCleanstall" -Command $nvidiaPath -LogContextKey "Video-Install-NVIDIA"
Write-StyledMessage -Type 'Success' -Text "Installazione driver NVIDIA completata."
}

if (-not $stableDownloadDone) {
Write-StyledMessage -Type 'Warning' -Text "Nessun driver stabile conosciuto trovato. Uso fallback autodetect."
switch ($gpuManufacturer) {
'AMD' {
$amdPath = Join-Path $desktopPath "AMD-Autodetect.exe"
if (-not (Invoke-ToolkitDownload -Uri $AppConfig.URLs.AMDInstaller -OutputPath $amdPath -Description "AMD Auto-Detect Tool")) {
Write-StyledMessage -Type 'Error' -Text "❌ Impossibile scaricare installer AMD. Annullamento."
return
}
}
'NVIDIA' {
$nvidiaPath = Join-Path $desktopPath "NVCleanstall_1.19.0.exe"
if (-not (Invoke-ToolkitDownload -Uri $AppConfig.URLs.NVCleanstall -OutputPath $nvidiaPath -Description "NVCleanstall")) {
Write-StyledMessage -Type 'Error' -Text "❌ Impossibile scaricare NVCleanstall. Annullamento."
return
}
}
'Intel' {
Write-StyledMessage -Type 'Info' -Text "GPU Intel: scarica driver manualmente da Intel se necessario."
}
default {
Write-StyledMessage -Type 'Warning' -Text "GPU non rilevata: driver non disponibile per l'installazione automatica."
}
}
'Intel' {
Write-StyledMessage -Type 'Info' -Text "GPU Intel rilevata. Usa Windows Update per aggiornare i driver integrati."
}
default {
Write-StyledMessage -Type 'Error' -Text "Produttore GPU non supportato o non rilevato per l'installazione automatica."
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions tool/GamingToolkit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function GamingToolkit {

[CmdletBinding()]
param(
[Parameter()]
[ValidateRange(0, 300)]
[int]$CountdownSeconds = 30,
[switch]$SuppressIndividualReboot
)
Expand Down
87 changes: 47 additions & 40 deletions tool/VideoDriverReinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,24 @@ function VideoDriverReinstall {
$driverToolsPath = $AppConfig.Paths.Drivers
$desktopPath = $AppConfig.Paths.Desktop

function Get-GpuManufacturer {
$pnpDevices = Get-PnpDevice -Class Display -ErrorAction SilentlyContinue
if (-not $pnpDevices) {
Write-StyledMessage -Type 'Warning' -Text "Nessun dispositivo display PnP rilevato."
return 'Unknown'
}
foreach ($device in $pnpDevices) {
$name = $device.FriendlyName
$mfr = $device.Manufacturer
if ($name -match 'NVIDIA|GeForce|Quadro|Tesla' -or $mfr -match 'NVIDIA') { return 'NVIDIA' }
if ($name -match 'AMD|Radeon|ATI' -or $mfr -match 'AMD|ATI') { return 'AMD' }
if ($name -match 'Intel|Iris|UHD|HD Graphics' -or $mfr -match 'Intel') { return 'Intel' }
}
return 'Unknown'
}

function Set-BlockWindowsUpdateDrivers {
Write-StyledMessage -Type 'Info' -Text "Blocco driver automatici da Windows Update."
try {
Set-RegistryValue -Path $AppConfig.Registry.WindowsUpdatePolicies -Name "ExcludeWUDriversInQualityUpdate" -Value 1
Write-StyledMessage -Type 'Success' -Text "Blocco WU driver impostato."
$gpupdateResult = Invoke-WithSpinner -Activity "Aggiornamento criteri di gruppo" -Command 'gpupdate.exe' -Arguments '/force' -LogContextKey "Video-GPUpdate"
if ($gpupdateResult.ExitCode -eq 0) {
Write-StyledMessage -Type 'Success' -Text "Criteri di gruppo aggiornati."
$gpupdateResult = Invoke-WithSpinner -Activity "Aggiornamento criteri di gruppo (può impiegare 1-2 minuti)" -Command 'gpupdate.exe' -Arguments '/force' -LogContextKey "Video-GPUpdate" -TimeoutSeconds 180
if ($gpupdateResult -and $gpupdateResult.ExitCode -eq 0) {
Write-StyledMessage -Type 'Success' -Text "✅ Criteri di gruppo aggiornati."
}
elseif ($gpupdateResult) {
Write-StyledMessage -Type 'Warning' -Text "⚠️ gpupdate completato con codice: $($gpupdateResult.ExitCode). Proseguo comunque."
}
else {
Write-StyledMessage -Type 'Warning' -Text "gpupdate completato con codice: $($gpupdateResult.ExitCode)."
Write-StyledMessage -Type 'Warning' -Text "⚠️ gpupdate non ha risposto. Proseguo comunque."
}
}
catch {
Write-StyledMessage -Type 'Warning' -Text "Errore blocco WU driver: $($_.Exception.Message)."
Write-StyledMessage -Type 'Warning' -Text "⚠️ Errore blocco WU driver: $($_.Exception.Message). Proseguo comunque."
}
}

Expand All @@ -56,7 +43,8 @@ function VideoDriverReinstall {
try {
Write-StyledMessage -Type 'Warning' -Text "🔧 Avvio procedura reinstallazione/riparazione driver video."
Set-BlockWindowsUpdateDrivers


Write-StyledMessage -Type 'Info' -Text "📥 Preparazione download strumenti necessari..."
# Download e estrazione DDU
$dduZipPath = Join-Path $driverToolsPath "DDU.zip"
if (-not (Invoke-ToolkitDownload -Uri $AppConfig.URLs.DDUZip -OutputPath $dduZipPath -Description "DDU (Display Driver Uninstaller)")) {
Expand All @@ -75,29 +63,48 @@ function VideoDriverReinstall {
}

# Download installer driver rilevato (sul Desktop per uso in Safe Mode)
$gpuManufacturer = Get-GpuManufacturer
$gpuAnalysis = VcardAnalizer
$gpuManufacturer = $gpuAnalysis.PrimaryManufacturer
Write-StyledMessage -Type 'Info' -Text "GPU rilevata: $gpuManufacturer."

switch ($gpuManufacturer) {
'AMD' {
$amdPath = Join-Path $desktopPath "AMD-Autodetect.exe"
if (-not (Invoke-ToolkitDownload -Uri $AppConfig.URLs.AMDInstaller -OutputPath $amdPath -Description "AMD Auto-Detect Tool")) {
Write-StyledMessage -Type 'Error' -Text "Impossibile scaricare installer AMD. Annullamento."
return
$stableDownloadDone = $false
if ($gpuAnalysis.Matches.Count -gt 0) {
foreach ($match in $gpuAnalysis.Matches) {
if ([string]::IsNullOrWhiteSpace($match.DownloadUrl)) { continue }
$targetName = if (-not [string]::IsNullOrWhiteSpace($match.FileName)) { $match.FileName } else { "$($match.Key).exe" }
$targetPath = Join-Path $desktopPath $targetName
$displayName = if (-not [string]::IsNullOrWhiteSpace($match.DisplayName)) { $match.DisplayName } else { $match.Key }

if (Invoke-ToolkitDownload -Uri $match.DownloadUrl -OutputPath $targetPath -Description $displayName) {
Write-StyledMessage -Type 'Success' -Text "Driver stabile scaricato sul desktop: $displayName"
$stableDownloadDone = $true
}
}
'NVIDIA' {
$nvidiaPath = Join-Path $desktopPath "NVCleanstall_1.19.0.exe"
if (-not (Invoke-ToolkitDownload -Uri $AppConfig.URLs.NVCleanstall -OutputPath $nvidiaPath -Description "NVCleanstall")) {
Write-StyledMessage -Type 'Error' -Text "Impossibile scaricare NVCleanstall. Annullamento."
return
}

if (-not $stableDownloadDone) {
Write-StyledMessage -Type 'Warning' -Text "Nessun driver stabile conosciuto trovato. Uso fallback autodetect."
switch ($gpuManufacturer) {
'AMD' {
$amdPath = Join-Path $desktopPath "AMD-Autodetect.exe"
if (-not (Invoke-ToolkitDownload -Uri $AppConfig.URLs.AMDInstaller -OutputPath $amdPath -Description "AMD Auto-Detect Tool")) {
Write-StyledMessage -Type 'Error' -Text "❌ Impossibile scaricare installer AMD. Annullamento."
return
}
}
'NVIDIA' {
$nvidiaPath = Join-Path $desktopPath "NVCleanstall_1.19.0.exe"
if (-not (Invoke-ToolkitDownload -Uri $AppConfig.URLs.NVCleanstall -OutputPath $nvidiaPath -Description "NVCleanstall")) {
Write-StyledMessage -Type 'Error' -Text "❌ Impossibile scaricare NVCleanstall. Annullamento."
return
}
}
'Intel' {
Write-StyledMessage -Type 'Info' -Text "GPU Intel: scarica driver manualmente da Intel se necessario."
}
default {
Write-StyledMessage -Type 'Warning' -Text "GPU non rilevata: solo DDU verrà posizionato sul Desktop."
}
}
'Intel' {
Write-StyledMessage -Type 'Info' -Text "GPU Intel: scarica driver manualmente da Intel se necessario."
}
default {
Write-StyledMessage -Type 'Warning' -Text "GPU non rilevata: solo DDU verrà posizionato sul Desktop."
}
}

Expand Down