Files
management-scripts/Install-Nextcloud.ps1
T

23 lines
1.1 KiB
PowerShell
Raw Normal View History

2020-11-07 08:35:18 -05:00
## Define URL for downloading the installer
2020-11-06 11:24:16 -05:00
$URL = 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources/Nextcloud-3.0.3-setup.exe'
2020-09-08 22:17:51 -04:00
## Stop app if it's currently running
2020-11-07 08:34:44 -05:00
End-Process -Name 'nextcloud' -Force
2020-09-08 22:17:51 -04:00
## Get the install location so we can start the app again after installation
If ( Test-Path "HKLM:SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" )
{ $InstallPath = '{0}\nextcloud.exe' -f $(Get-ItemProperty -Path "HKLM:SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" -ErrorAction SilentlyContinue).InstallLocation }
ElseIf ( Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" )
{ $InstallPath = '{0}\nextcloud.exe' -f $(Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" -ErrorAction SilentlyContinue).InstallLocation }
## Install package
2020-11-07 08:34:44 -05:00
Install-Program -Path $(Download-File -URL $URL) -Arguments "/S" -Delete
2020-09-08 22:17:51 -04:00
## Start the app after installation
If ( Test-Path $InstallPath )
{
2023-10-05 13:11:38 -04:00
Write-Output "Starting Nextcloud"
2020-10-22 14:01:35 -04:00
Try { Start-Process $InstallPath }
2023-10-05 13:17:18 -04:00
Catch { Write-Error $_.Exception.Message }
2020-09-08 22:17:51 -04:00
}