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();
}