Nieuwe downloadlocatie
This commit is contained in:
26
DownloadClient.ps1
Executable file
26
DownloadClient.ps1
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/pwsh
|
||||||
|
|
||||||
|
$OrigLocation = Get-Location
|
||||||
|
if (Test-Path "/home/thomas/Applicaties/Nextcloud") {
|
||||||
|
Set-Location "/home/thomas/Applicaties/Nextcloud"
|
||||||
|
}
|
||||||
|
if (Test-Path "\\fs01\data\Applicaties\Nextcloud") {
|
||||||
|
Set-Location "\\fs01\data\Applicaties\Nextcloud"
|
||||||
|
}
|
||||||
|
$Answer = Invoke-WebRequest "https://download.nextcloud.com/desktop/releases/Windows/"
|
||||||
|
$FileName=($Answer.Links|Where-Object{$_.href -like "*64.msi"})[-1].outerHTML.Split("`"")[1]
|
||||||
|
$Link = "https://download.nextcloud.com/desktop/releases/Windows/$($FileName)"
|
||||||
|
$LocalPath = "$($PWD.Path)/"
|
||||||
|
$LocalFileName = "$($LocalPath)$($FileName)"
|
||||||
|
if(-not (Test-Path $LocalFileName)){
|
||||||
|
Write-Output "Downloading $Link to $LocalFileName"
|
||||||
|
Invoke-WebRequest -Uri $Link -OutFile $LocalFileName
|
||||||
|
if(Test-Path "Nextcloud-latest-x64.msi"){
|
||||||
|
Remove-Item "Nextcloud-latest-x64.msi"
|
||||||
|
}
|
||||||
|
Copy-Item $LocalFileName "Nextcloud-latest-x64.msi"
|
||||||
|
} else {
|
||||||
|
Write-Output "$FileName already exists"
|
||||||
|
}
|
||||||
|
|
||||||
|
Set-Location $OrigLocation
|
||||||
Reference in New Issue
Block a user