Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 33 additions & 2 deletions WinToolkit-template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,7 @@ function WinDriverInstall {}
function WinDebloat {}
function WinCleaner {}
function DisableBitlocker {}
function WinDeleteUserProfiles {}

# Office
function Install-Office {}
Expand Down Expand Up @@ -1939,7 +1940,8 @@ $menuStructure = @(
[pscustomobject]@{Name = 'WinReinstallStore'; Description = 'Winget/WinStore Reset'; Action = 'RunFunction' },
[pscustomobject]@{Name = 'WinBackupDriver'; Description = 'Backup Driver PC'; Action = 'RunFunction' },
[pscustomobject]@{Name = 'WinCleaner'; Description = 'Pulizia File Temporanei'; Action = 'RunFunction' },
[pscustomobject]@{Name = 'DisableBitlocker'; Description = 'Disabilita Bitlocker'; Action = 'RunFunction' }
[pscustomobject]@{Name = 'DisableBitlocker'; Description = 'Disabilita Bitlocker'; Action = 'RunFunction' },
[pscustomobject]@{Name = 'WinDeleteUserProfiles'; Description = 'Cancella profili utenti di Windows'; Action = 'RunFunction' }
)
},
@{ 'Name' = 'Office'; 'Icon' = '🏒'; 'Scripts' = @(
Expand Down Expand Up @@ -1985,7 +1987,30 @@ if (-not $ImportOnly -and -not $Global:GuiSessionActive) {
Write-StyledMessage -Type 'Info' -Text 'πŸ’Ž WinToolkit avviato in modalitΓ  interattiva'
Write-Host ""

while ($true) {
function Confirm-UserProfileDeletion {
Write-Host ''
Write-StyledMessage -Type 'Error' -Text 'ATTENZIONE: eseguendo questa opzione verranno cancellati tutti i profili utenti di Windows, escluso l''utente attuale.'
Write-StyledMessage -Type 'Error' -Text 'I dati contenuti nei profili eliminati saranno irrecuperabili.'
Write-Host ''
Write-Host 'πŸ’Ž [1] SΓ¬, cancella i profili utenti' -ForegroundColor White
Write-Host '[INVIO] Torna al menu principale' -ForegroundColor Gray
$firstConfirm = Microsoft.PowerShell.Utility\Read-Host 'Selezione'

if ($firstConfirm -ne '1') {
return $false
}

Write-Host ''
Write-StyledMessage -Type 'Error' -Text 'Sei proprio sicuro?'
Write-Host ''
Write-Host 'πŸ’Ž [1] SΓ¬, sono sicuro di ciΓ² che sto facendo e me ne assumo la responsabilitΓ  in caso di cancellazione di file' -ForegroundColor White
Write-Host '[INVIO] Torna al menu principale' -ForegroundColor Gray
$secondConfirm = Microsoft.PowerShell.Utility\Read-Host 'Selezione'

return ($secondConfirm -eq '1')
}

:MainMenu while ($true) {
Show-Header -SubTitle "Menu Principale"

# ── Informazioni di sistema ───────────────────────────────────────────
Expand Down Expand Up @@ -2076,6 +2101,12 @@ if (-not $ImportOnly -and -not $Global:GuiSessionActive) {

foreach ($sel in $selections) {
$scriptToRun = $allScripts[$sel - 1]
if ($scriptToRun.Name -eq 'WinDeleteUserProfiles' -and -not (Confirm-UserProfileDeletion)) {
Write-StyledMessage -Type 'Warning' -Text 'Operazione annullata. Ritorno al menu principale.'
Start-Sleep -Seconds 2
continue MainMenu
}

Write-StyledMessage -Type 'Progress' -Text "▢️ Avvio: $($scriptToRun.Description)"
Write-Host ''
try {
Expand Down
Loading
Loading