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.








Saturday, 28 November 2015

Security Filter

                              


                                    Security Filter


A security filter is a filter object that you assign to users or groups to restrict the result set when they execute reports or browse elements.

Security filters enables you at MicroStrategy level, What warehouse data users can see.

Criteria specified by the security filter is added to the where clause of every SQL pass.

Example: Two regional manager have their own security filters, according to the region that they manage. One with Northeast and other with southeast..
 If these two users with different security filters run the same report, they may get different results based on the criteria defined in their security filters.


Prerequisites

The security filter you want to assign to a user or group must already exist in MicroStrategy Developer.

To assign security filters, you must have the necessary privileges.

Lets run a report without security filter.
                 

How to create security filter-->

  • Go to the project where you want to create security filter.

  • Go to Project Objects and click on MD security filters.All security filter should be placed in this folder.

  • Create New and choose security filter.
             

  • Below window will appear.


  • Apply filter on the attribute on which you want to create filter.


  • Choose the region whose data you want to show to the user/group.

  • Go to user manager then search the user/group to which you want to assign security filter and edit the user/group.



  • Drag the required security filter to the right hand side.


  • Now execute the same report with security filter of Northwest and see the difference.



Wednesday, 11 February 2015

Command Manager

MicroStrategy Command Manager:


MicroStrategy Command Manager is a script based tool that is used to automate Intelligence server administrative tasks.Command Manager scripts reduce a lot of manual work and save a lot of time.

There are various feature available with command manager.We can write simple one line command as well as long procedures .Procedures in Command Manager uses some features of Java Script. But there is some limitations on it.All the java Scripts features are not supported in MicroStrategy Command Manager.

We can use Command Manager on both Windows and Linux machines.But You can find some commands which run fine on windows machine but not on Linux..Well that is limitation of MicroStrategy. Commands which are given in Outlines of Linux I-server can only work on Linux.

You can invorke command Manager on Windows machine by clicking on Start -->All Programs--->MicroStrategy Products---->Command Manager


On Linux machine--

You have to run mstrcmdmgr from bin folder of MicroStrategy on Linux

${BIN_PATH}\mstrcmdmgr -n ${Project_Source} -i -e -u {UserName} -p {Password}  -f {input file} -o {ouput file}

You can write all your commands in your input file.

You can do all type of tasks from Command manager like you can List projects from Command as well as apply ACL on a Project.You can also create new users or new database instances.


Some basic commands:-

Report Outlines:

LIST ALL PROPERTIES FOR REPORT "ABC" IN FOLDER "XYX" FOR PROJECT "TEST";

LIST ALL PROPERTIES FOR REPORT "Profit Forecast" IN FOLDER "\Public Objects\Reports\Subject Areas\Enterprise Performance Management" FOR PROJECT "MicroStrategy Tutorial";

LIST ALL REPORTS FOR PROJECT "MicroStrategy Tutorial";

LIST ALL REPORTS IN FOLDER "\Public Objects\Reports\Subject Areas\Enterprise Performance Management" FOR PROJECT "MicroStrategy Tutorial";


User Group Outlines:


CREATE USER GROUP "ManagersXYZ" MEMBERS "Developer","User";

ALTER USER GROUP "ManagersXYZ" DESCRIPTION "Managers of XYZ Company";

LIST NAME, DESCRIPTION, MEMBERS FOR USER GROUP "ManagersXYZ";

LIST PRIVILEGES FOR USER GROUP "ManagersXYZ";

LIST ALL MEMBERS FOR USER GROUP "ABC_ALL_Desktop_Designer";

DELETE USER GROUP "ManagersXYZ";


User Outlines:


LIST ALL PRIVILEGES FOR USER "demo";

CREATE USER GROUP "ManagersXYZ" MEMBERS "Developer","User";

ALTER USER GROUP "ManagersXYZ" DESCRIPTION "Managers of XYZ Company";

LIST NAME, DESCRIPTION, MEMBERS FOR USER GROUP "ManagersXYZ";

LIST PRIVILEGES FOR USER GROUP "ManagersXYZ";

LIST [ALL] REPORTS [IN FOLDER ""] FOR PROJECT "";

CREATE USER (IMPORTWINUSER "" | "") [FULLNAME ""] [DESCRIPTION ""] [LONGDESCRIPTION ""] [(NTLINK "" | NTSID "")] [PASSWORD ""] [LDAPLINK ""] [TRUSTEDLOGIN ""] [WHLINK "" [WHPASSWORD ""]] [ALLOWCHANGEPWD (TRUE | FALSE)] [ALLOWSTDAUTH (TRUE | FALSE)] [CHANGEPWD (TRUE | FALSE)] [PASSWORDEXP (NEVER | IN DAYS | ON )] [PASSWORDEXPFREQ DAYS] [(ENABLED | DISABLED)] [IN GROUP ""];

CREATE USER  "abc1" FULLNAME "abc xyz" ALLOWSTDAUTH FALSE TRUSTEDLOGIN "abc1" IN GROUP "group name";


Project Outlines:


UNLOAD PROJECT "MicroStrategy Tutorial";

LOAD PROJECT "MicroStrategy Tutorial";

LIST ALL PROJECT;

CREATE PROJECT "New Project" DESCRIPTION "A new empty project";

DELETE PROJECT "My first project";

ALTER PROJECT "My First Project" DESCRIPTION "A modified empty project";

Subscription Outlines:

If you want to find out list of subscriptions for a particular Project,Then you can write below command.

LIST ALL SUBSCRIPTIONS FOR PROJECT "PROJECT NAME";

Folder Outlines:



CREATE FOLDER "New Reports" IN "\Public Objects" DESCRIPTION "New Sales Reports" HIDDEN FALSE FOR PROJECT "MicroStrategy Tutorial";

CREATE FOLDER "Public Objects Backup" IN "\" DESCRIPTION "Backup of Public Objects" HIDDEN TRUE FOR PROJECT "MicroStrategy Tutorial";

ALTER FOLDER "New Reports" IN "\Public Objects" NAME "Sales Reports" FOR PROJECT "MicroStrategy Tutorial";

LIST ALL PROPERTIES FOR FOLDER "Sales Reports" IN "\Public Objects" FOR PROJECT "MicroStrategy Tutorial";

LIST FOLDERS IN "\Public Objects" FOR PROJECT "MicroStrategy Tutorial";

/* Removes all the contents of folder Sales Reports, including subfolders */
REMOVE FOLDER CONTENT CASCADE "Sales Reports" IN "\Public Objects" FROM PROJECT "MicroStrategy Tutorial";

/* Removes all the contents of folder Sales Reports, excluding subfolders */
REMOVE FOLDER CONTENT "Sales Reports" IN "\Public Objects" FROM PROJECT "MicroStrategy Tutorial";

DELETE FOLDER "Sales Reports" IN "\Public Objects" FROM PROJECT "MicroStrategy Tutorial";



DB Instance Outlines


LIST ALL PROPERTIES FOR DBINSTANCE "Production Database";

Event Outlines


LIST ALL EVENTS;

CREATE EVENT "My Daily Report" DESCRIPTION "My Daily Report";

TRIGGER EVENT "My Daily Report";

DELETE EVENT "DBMS Load";

Procedure: Procedure is step-by-step sequence of command that should be followed in the same order to do a task.Command Manager procedure uses some features of Java Script.

Sample Procedure:



Procedure to get the DB login with no dependent

String objectType = "DBLOGIN";

//find all dblogin
String sQuery = "LIST ALL " + objectType + "S;";
ResultSet objects = executeCapture(sQuery);

objects.moveFirst();
//let's process the objects in the topfolder
while(!objects.isEof()){
String objectName = objects.getFieldValueString(DisplayPropertyEnum.DB_LOGIN);
//get dependent result set for this dblogin
sQuery = "LIST DEPENDENTS FOR " + objectType + " \"" + objectName + "\";";
ResultSet dependents = executeCapture(sQuery);

//if there is no dependent, print this dblogin
if(dependents.getRowCount() == 0){
printOut(objectType + " '" + objectName + "' has no dependent." );
}
objects.moveNext();
}