Last active
November 4, 2016 18:40
-
-
Save jdnow/986326a6fd531c6ea42b to your computer and use it in GitHub Desktop.
Installs and Configure Owncloud on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set objFSO=CreateObject("Scripting.FileSystemObject") | |
Set WshNetwork = WScript.CreateObject("WScript.Network") | |
Set oShell = CreateObject( "WScript.Shell" ) | |
owncloudsrv = "http://owncloudserver" 'Replace with your Owncloud server address | |
installsite = "\\server\share\owncloud-setup.exe" 'Replace with your install site for the client | |
uname = WshNetwork.UserName | |
localapppath = oShell.ExpandEnvironmentStrings("%LOCALAPPDATA%") | |
oShell.Run installsite & " /S", 1, true | |
WScript.Sleep 5000 | |
If ReturnCode <> 0 Then | |
WScript.Echo "Error with OwnCloud Installer. Installer Returned: " & ReturnCode | |
Wscript.Quit | |
End If | |
If objFSO.FileExists("C:\Program Files (x86)\ownCloud\owncloud.exe") Then | |
OCLoc = "C:\Program Files (x86)\ownCloud\owncloud.exe" | |
Else | |
OCLoc = "C:\Program Files\ownCloud\owncloud.exe" | |
End If | |
oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\ownCloud",OCLoc,"REG_SZ" | |
If Not (objFSO.FolderExists(localapppath + "\ownCloud")) Then | |
Set objFolder = objFSO.CreateFolder(localapppath + "\ownCloud") | |
End If | |
IGNOREFile = localapppath + "\ownCloud\sync-exclude.lst" | |
Set objFile = objFSO.CreateTextFile(IGNOREFile, True) | |
objFile.Write "*.iso" & vbCrlf | |
objFile.Write "*.bin" & vbCrlf | |
objFile.Write "*.pst" & vbCrlf | |
objFile.Close | |
Set objFile = Nothing | |
OCONFIGFile = localapppath + "\ownCloud\owncloud.cfg" | |
Set objFile = objFSO.CreateTextFile(OCONFIGFile, True) | |
objFile.Write "[General]" & vbCrlf | |
objFile.Write "optionalDesktopNotifications=true" & vbCrlf | |
objFile.Write "[Proxy]" & vbCrlf | |
objFile.Write "type=2" & vbCrlf | |
objFile.Write "[ownCloud]" & vbCrlf | |
objFile.Write "url="& owncloudsrv & vbCrlf | |
objFile.Write "http_user=" & uname & vbCrlf | |
objFile.Write "authType=http" & vbCrlf | |
objFile.Write "user=" & uname & vbCrlf | |
objFile.Close | |
Set objFile = Nothing | |
If Not (objFSO.FolderExists(localapppath + "\ownCloud\folders")) Then | |
Set objFolder = objFSO.CreateFolder(localapppath + "\ownCloud\folders") | |
End If | |
DESKTOPFile = localapppath + "\ownCloud\folders\Desktop" | |
Set objFile = objFSO.CreateTextFile(DESKTOPFile, True) | |
objFile.Write "[Desktop]" & vbCrlf | |
objFile.Write "localPath=C:\\Users\\" & uname & "\\Desktop" & vbCrlf | |
objFile.Write "targetPath=/Desktop" & vbCrlf | |
objFile.Write "backend=owncloud" & vbCrlf | |
objFile.Write "connection=ownCloud" & vbCrlf | |
objFile.Close | |
Set objFile = Nothing | |
DOCUMENTFile = localapppath + "\ownCloud\folders\Documents" | |
Set objFile = objFSO.CreateTextFile(DOCUMENTFile, True) | |
objFile.Write "[Documents]" & vbCrlf | |
objFile.Write "localPath=C:\\Users\\" & uname & "\\Documents" & vbCrlf | |
objFile.Write "targetPath=/Documents" & vbCrlf | |
objFile.Write "backend=owncloud" & vbCrlf | |
objFile.Write "connection=ownCloud" & vbCrlf | |
objFile.Close | |
Set objFile = Nothing | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment