mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-08-24 00:02:44 +02:00
24 lines
816 B
PowerShell
24 lines
816 B
PowerShell
|
$Logfile = "C:\Windows\Temp\dotnet-install.log"
|
||
|
function LogWrite {
|
||
|
Param ([string]$logstring)
|
||
|
$now = Get-Date -format s
|
||
|
Add-Content $Logfile -value "$now $logstring"
|
||
|
Write-Host $logstring
|
||
|
}
|
||
|
|
||
|
LogWrite "Downloading dotNet 4.5.1"
|
||
|
try {
|
||
|
(New-Object System.Net.WebClient).DownloadFile('http://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe', 'C:\Windows\Temp\dotnet.exe')
|
||
|
} catch {
|
||
|
LogWrite $_.Exception | Format-List -force
|
||
|
LogWrite "Failed to download file."
|
||
|
}
|
||
|
|
||
|
LogWrite "Starting installation process..."
|
||
|
try {
|
||
|
Start-Process -FilePath "C:\Windows\Temp\dotnet.exe" -ArgumentList "/I /q /norestart" -Wait -PassThru
|
||
|
} catch {
|
||
|
LogWrite $_.Exception | Format-List -force
|
||
|
LogWrite "Exception during install process."
|
||
|
}
|