Tuesday, 29 December 2015

How to automate MicroStrategy Project duplication

                     
                   

                                   Project Duplication


We can automate duplication of MicroStrategy projects in two ways.

1. Projectduplicate.exe
2. System Manager


In both the cases,We need an xml file which stores all the information related to source project source,destination project source,project to duplicate and name of the target project etc.

This xml file can be created by running object manager manually and by choosing all the required options and at the end of that wizard,you will get an option to save all those setting in xml file.
Later,you can use this xml file for project duplication through Projectduplicate.exe or system manager.


Projectduplicate.exe file exists at C:\Program Files\Common Files\MicroStrategy.If your MicroStrategy is installed in 64 bit OS then it would be at C:\Program Files(x 86)\Common Files\MicroStrategy.if your MicroStrategy is installed in D Drive then use D drive instead of C.

C:\Program Files\Common Files\MicroStrategy>projectduplicate.exe -f c:\projdup.xml -sp src_pwd -dp des_pwd

  •  c:\ is the path to the saved XML settings file.
  • projdup.xml is the name of the saved XML settings file.
  • SourcePassword is the password for the source project’s project source.
  • TargetPassword is the password for the destination project’s project source.
  • Optional: -sup indicates that feedback messages will be suppressed (silent mode).
  • Optional: -md indicates that the metadata of the destination project source will be updated if it is older than the source project source’s metadata.
  • Optional: -dn OverwriteName specifies the name of the destination project. This overrides the name specified in the XML settings file


You can run this command from cmd to execute it manually.you can change
 the source or target project according to your requirement in xml file.


After testing it manually, you need to create a batch script.For that,you need below things.

1. Notepad file,
which contains name of the project to be duplicated.You can provide some other things like date which you may want to append at the end of target project.
You can also provide option if you want to copy subscriptions or not.

2. Projectduplicate.xml file

This file which you have created manually with object manager.This will act as a source xml file

Now what you can do,Create a batch script to do the below tasks

1. Replace project name,subscription flag or any other thing which you want to modify with variable  in source xml file.
2. provide source file and target file path in batch script.Target file will be created when script will replace variables with actual values.

something like this. delims=, means that values you provide in text file is separated 
tokens=1,2,3 means it will take first 3 values.If you want to provide more values,you can increase this count.

for /F "tokens=1,2,3 delims=," %%i in (myfile.txt) do 
3. After replacing these values,call projectduplicate.exe command.

if you are using system manager then call system manager.