Script to move client from owncloud to nextcloud (windows)


#1

Hello. I have written mini bat file to help migrating from owncloud client to nextcloud. Maybe someone will help it usefull:

if exist "C:\Program Files (x86)\ownCloud\uninstall.exe" ("C:\Program Files (x86)\ownCloud\uninstall.exe" /S) else ( if exist "c:\Program Files\ownCloud\uninstall.exe" ( "c:\Program Files\ownCloud\uninstall.exe" /S) else exit ) 
md %LocalAppData%\Nextcloud\
copy %LocalAppData%\ownCloud\owncloud.cfg %LocalAppData%\Nextcloud\nextcloud.cfg
start Nextcloud-2.2.3.4-setup.exe /S

This script trying to find unistaller of owncloud client and if it finds, it will delete it quietly, after this script move config and start silent install of nextcloud client. If unistaller not found, script will exit. Note that installer file Nextcloud-2.2.3.4-setup.exe must remain in same dir where script have been executed.
You can get bat from my cloud
http://cloud.kasakoff.net/index.php/s/tbntMckWQqrCsxt

Also note that nextcloud client will not be automatically started after installing, you should start it manually, and also manually check switch to autorun client with windows. If you know install flags to enable it silently, please tell me how.
Sometimes nextcloud client ask for password after this script, sometimes not, I don’t know why. Also windows may ask you to confirm action when nextcloud client installing.

UPD (9 september): fixed script to work on 32 bit systems


#2

Moved to tips&tricks.

The latest desktop client: https://nextcloud.com/install/#install-clients


#3

I have written this script for this purpose, it is tested only on one computer, but it seems to be working. It should work probably on any Windows with Powershell, only non standard program used is pskill.exe from Sysiternals Suite.

@echo off
 
rem switch to directory with this script in it
%~d0
cd "%~p0"

echo It is recommended to have all things saved and be prepared to restart before continuing running this script (it will probably not be necessary but ...).
echo Please close programs which have opened ownCloud data directory or something from it.
echo This script will kill explorer.exe (taskbar, explorer windows), then run it again.
echo After end of migration please start Nextcloud client manually, enter username and password, then also manually check switch to autorun client with Windows (Launch on System Startup) and set "No Proxy" under Network. And it may be necessary to uncheck "Show sync folders in Explorer's Navigation Page" and check it again to have displayed Nextcloud in Explorer's left pane.

pause
if exist "%LocalAppData%\ownCloud\owncloud.cfg" (echo ownCloud config found at %LocalAppData%) else ( if exist "%AppData%\ownCloud\owncloud.cfg" ( echo ownCloud config found at %AppData%) else goto OWNCLOUD_CONFIG_NOT_FOUND )


echo Killing explorer.exe and owncloud.exe
pskill /accepteula explorer.exe
pskill /accepteula owncloud.exe

echo Uninstalling ownCloud client, please click Yes, then Yes (in UAC(full admin) dialog)
pause

if exist "C:\Program Files (x86)\ownCloud\uninstall.exe" ("C:\Program Files (x86)\ownCloud\uninstall.exe" /S /norestart) else ( if exist "c:\Program Files\ownCloud\uninstall.exe" ( "c:\Program Files\ownCloud\uninstall.exe" /S /norestart) else C:\Windows\System32\msiexec.exe /uninstall {9D54B270-1A33-4E2E-B0F1-69B78E8EE3BF} /norestart ) 

echo Removing ownCloud from left pane in Explorer
reg add HKCU\Software\Classes\CLSID\{535325f1-f68f-41f7-9009-2a741e8a212a} /v System.IsPinnedToNameSpaceTree /t REG_DWORD /d 0x0 /f

echo Copying ownCloud client config to Nextcloud client config
md %AppData%\Nextcloud\
if exist "%LocalAppData%\ownCloud\owncloud.cfg" (copy %LocalAppData%\ownCloud\owncloud.cfg %AppData%\Nextcloud\nextcloud.cfg) else ( if exist "%AppData%\ownCloud\owncloud.cfg" ( copy %AppData%\ownCloud\owncloud.cfg %AppData%\Nextcloud\nextcloud.cfg) else echo We should not get here !!! )


echo Renaming ownCloud data directory to Nextcloud
attrib -S -H %USERPROFILE%\ownCloud
rename %USERPROFILE%\ownCloud Nextcloud

echo Renaming ownCloud data directory to Nextcloud in %AppData%\Nextcloud\nextcloud.cfg

powershell -Command "(Get-Content %AppData%\Nextcloud\nextcloud.cfg) -replace 'https://databox.example.com/owncloud(/){0,1}', 'https://databox.example.com/nextcloud' | Foreach-Object {$_ -replace 'localPath=C:/Users/%USERNAME%/ownCloud/', 'localPath=C:/Users/%USERNAME%/Nextcloud/'} | Set-Content -encoding ASCII %AppData%\Nextcloud\nextcloud.cfg.new"

move /y %AppData%\Nextcloud\nextcloud.cfg.new %AppData%\Nextcloud\nextcloud.cfg


echo Starting Nextcloud client installation, please allow this installation UAC(full admin) dialog
pause

call Nextcloud-2.5.1-setup.exe /S /norestart

echo Starting explorer.exe again
start explorer.exe

echo Please start Nextcloud client manually, enter username and password, then also manually check switch to autorun client with Windows (Launch on System Startup).


pause

exit

:OWNCLOUD_CONFIG_NOT_FOUND

echo ownCloud config not found, exiting.

pause
exit