Nieuwe downloadlocatie

This commit is contained in:
2023-06-29 08:41:26 +02:00
parent 316ed8f78c
commit fe5e9dadc2

26
DownloadClient.ps1 Executable file
View 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