Run the ownCloud client via a Procedure either directly from Python or via Powershell

Hi I have been trying to get the ownCloud client running from a procedure but so far have been unsuccessful. The executable is owncloud.exe and the default location for it is “c:\program files (x86)\owncloud”

I can run it from a command prompt and I can run it from powershell but cannot get it to run as part of a procedure. Can you please assist me with this.

Thank-you for your help, John

@computerlifeline We’ll investigate on this issue and we’ll keep you posted.

Hi @computerlifeline,

Please use the script for your request.

Enter your command at the variable command=‘your_command’ that you want to execute with owncloudcmd.exe

Additionally, Please try your command with the file owncloudcmd.exe instead of owncloud.exe with your procedure :slight_smile:

command='--version' ## enter the command here, the command should be the actual commmand comes after the owncloudcmd.exe, please ensure that there is no leading space on your command
def ecmd(CMD, OUT=False):
    import ctypes
    class disable_file_system_redirection:
        _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
        _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
        def __enter__(self):
            self.old_value = ctypes.c_long()
            self.success = self._disable(ctypes.byref(self.old_value))
        def __exit__(self, type, value, traceback):
            if self.success:
                self._revert(self.old_value)
    from subprocess import PIPE, Popen
    with disable_file_system_redirection():
        OBJ = Popen(CMD, shell = True, stdout = PIPE, stderr = PIPE)
    out, err = OBJ.communicate()
    return out.strip()

import os
pfile86='C:\\Program Files (x86)\\ownCloud\\owncloudcmd.exe'
pfile64='C:\\Program Files\\ownCloud\\owncloudcmd.exe'
if os.path.isfile(pfile86):
    print ecmd('"'+pfile86+'" '+command)
elif os.path.isfile(pfile64):
    print ecmd('"'+pfile64+'" '+command)
else:
    print 'the files not found:
'+pfile86+'
'+pfile64

Sample Output:

Script in Json format:
20170316-Execute-Own-Cloud-Client-Command.json

Thank you.
Purushoth

EOCCCOP.png

20170316-Execute-Own-Cloud-Client-Command.json (1.86 KB)