Category: Technology
Hits: 6382

Converting MYOB to a terminal server brings big advantages, particularly if you have the database files on the terminal server as well. This articles discussed moving a directory tree of MYOB databases from a mapped network drive to a local drive, keeping security settings, and a python script to bulk update shortcut settings with the new location of the MYOB databases


To copy a tree of MYOB databases, mount the current location as a mapped drive on the terminal server, and copy. You need to preserve security.

On Windows Server 2008 R2 this command works: it copies an entire directory strucuture, and copies the security settings. In this case, the users were identical on the source and destination machine. MYOB was already running on the terminal server using the databases on the mapped drive. This is not optimal: using a terminal server means you can also keep the database files on a local hard drive, which is about as optimal as you can get with MYOB (MYOB Premier v19)

xcopy S:\Source D:\Destination /s /e /x /c /q /h /k /i /r /Y

(seen in this thread


(there are alternatives such as robocopy but I couldn't get them to work)


This client had many users using many different MYOB databases. I needed to change Desktop shortcuts to reflect the new location of the database file.

The following late-night Python script worked. Executed in ActiveState Python 2.7

Note that a Windows shortcut has a target path, which in this case points to the myobp.exe executable, and an argument which contains the location of the database file. I had to change the argument string. Below is the only technique which I could get to work.


# change certain shortcuts in all Desktop folders
import os,sys import glob from import shell, shellcon import re import pythoncom shortcut = pythoncom.CoCreateInstance ( shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink ) shortcuts=glob.glob(r"c:\Users\*\Desktop\*.lnk") paths1=glob.glob(r"p:\*\*.myo") for shortcut_path in shortcuts: pass persist_file = shortcut.QueryInterface (pythoncom.IID_IPersistFile) persist_file.Load (shortcut_path) target = shortcut.GetPath(shell.SLGP_UNCPRIORITY)[0].lower() args = shortcut.GetArguments().lower() wdir = r"C:\myob_data" # we only process MYOB shortcuts which point to the previously-used mapped drive for the database files if"myobp.exe",target) and'^"p:',args): args= args.replace("p:",r"c:\myob_data") print "Path:%s target:%s args:%s" % (shortcut_path, target,args) shortcut.SetArguments(args) shortcut.SetWorkingDirectory(wdir) persist_file.Save (shortcut_path, 0)

Based on ideas here: