function Invoke-Diskpart { param ( $script ) $file = New-TemporaryFile; $null = Set-Content "$file" "$script"; & diskpart -s "$file"; } $drives = & wmic volume get "DriveLetter,Label"; $drive = $($($drives | Select-String -Pattern "winiso") -split "\s+")[0]; Write-Warning "Attention: This program will completely wipe your current disk #1 and install Windows on it. Are you sure you want to do this?" Read-Host -Prompt "Hit enter to continue or CTRL+C to abort" & "$drive\setup.exe";