| 1 | + | $workdir = "c:\installer\" |
| 2 | + | |
| 3 | + | If (Test-Path -Path $workdir -PathType Container) |
| 4 | + | { Write-Host "$workdir already exists" -ForegroundColor Red} |
| 5 | + | ELSE |
| 6 | + | { New-Item -Path $workdir -ItemType directory } |
| 7 | + | |
| 8 | + | $source = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US" |
| 9 | + | $destination = "$workdir\firefox.exe" |
| 10 | + | |
| 11 | + | if (Get-Command 'Invoke-Webrequest') |
| 12 | + | { |
| 13 | + | Invoke-WebRequest $source -OutFile $destination |
| 14 | + | } |
| 15 | + | else |
| 16 | + | { |
| 17 | + | $WebClient = New-Object System.Net.WebClient |
| 18 | + | $webclient.DownloadFile($source, $destination) |
| 19 | + | } |
| 20 | + | |
| 21 | + | Start-Process -FilePath "$workdir\firefox.exe" -ArgumentList "/S" |
| 22 | + | |
| 23 | + | Start-Sleep -s 35 |
| 24 | + | |
| 25 | + | rm -Force $workdir/firefox* |