juli 06, 2017
If you want to have users created automatically from a certain list, there are several ways to achieve it. I chose to use Windows PowerShell and have it scheduled with Windows Task Manager.
What you need:
• Basic to average knowledge of Windows PowerShell
• Basic knowledge of MicroStrategy Command Manager
• Admin rights to the server your MicroStrategy environment is running on
• Access to Windows Task Manager
In my example, the list of users is stored in Active Directory. But with a few changes, you can use this for any other list possible.
First of all, you need to have a list of all Active Directory groups and after that, you need to define whether the group is a domain.
You will most probably not need the entire Active Directory. So you will need a filter that will get you the groups where your users are stored.
From all groups retrieved, you still have to get the users.
This output should be saved in a CSV-file. You will have to use this later to create the new users.
In the same folder (in this case, it is d:\MicroStrategyShared\Powershell\) you have to create an empty CSV with the name ‘output_yesterday.csv’. Then you create the next variables:
In the next step, you loop through all the users remaining and you create variables for each property needed.
After this, you will need to create several Command Manager statements, I used 3:
Just to sure, add a line at the bottom: $create = $null. Then you close the loop with a ‘}’
The output of the loop is stored in an SCP-file which will, later on, be used to create the user in MicroStrategy.
Before the execution of the report you need to make some changes to the CSV files with the user outputs. The output_yesterday.csv file will be deleted and the output.csv file will be renamed to output_yesterday.csv. The next time you run the script, the new output.csv will be compared with the script that was renamed the last time you ran it.
To execute the script, you have to build the command first. After that you can execute the script.
$command = @'
cmd.exe /C cmdmgr -n "PROJECT" -u Administrator -f
D:\MicroStrategyShared\Powershell\update.scp -p p@ssW0rd
To schedule the PowerShell script, I use Windows Task Manager on Windows Server.
Open Task Manager and click ‘Create Task’ in the right column. Following window pops up:
After naming the Task, move to the Triggers tab, select New
When you reach this point, your automatic user creation flow should be ready. It should run whenever you scheduled it.
Move to the Actions tab and select New:
In the Add arguments box, this is what it should state:
-ExecutionPolicy Bypass D:\MicroStrategyShared\Powershell\[CreateUserScript].ps1
Your automatic user creation script is now scheduled.
Agiliz is the preferred partner in MicroStrategy consultancy. All our consultants are certified within every aspect of the leading enterprise Business Intelligence platform. We take great pride in building the best possible BI solutions for the most demanding customers.