It should be noted that if detail regarding PowerShell Module Commands, Script Variables, etc are required then users should refer to the associated solution article here https://managementstudio.com/a/solutions/articles/14000111736
TABLE OF CONTENTS
Example
This example will add applications to migration user records if an application is a member of a specific Blueprint.
Step 1: Create some Blueprints for applications by the department
- Go to Administration\Project Admin\Blueprints
- Create a new folder below the root called "Apps by Department"
- Create some Blueprints underneath "Apps By Department"
Step 2: Add some apps to the new Blueprints
- Go to Applications - Main Grid
- Select some applications
- Right-click and add them to one of the new blueprints you have created.
Note: For the purpose of this exercise add 10-15 apps per Blueprint.
Step 3: Create a PowerShell Object
- Go to Administration->PS Scripts, Email, Buttons (1)
- Click on the Project module name (2)
- Choose Click here to add new item (3) to create a new entry for the script:
- Set "Script Name" to Link Users to Apps Via Blueprint
- Set "Category" to Grid Action (Free Type)
- Select the "User Migrations" from the Module dropdown
- Set "Run As" to API Account from the dropdown
Step 4: Add The PowerShell Script
Note: While this document will show the PowerShell required to perform this action for detailed information regarding PowerShell please refer to the link at the top of this document.
- Click the Edit button on the grid row you configured above
- This will open the PowerShell Editor window.
- Paste in the following PowerShell script:
## Set Button EventArgs1 to be your BP Path i.e. 'Apps By Department\Accounts' ## Get the Users Selected on the grid when button was pressed $userIds = $ScriptArgs.Items ## Script arguments passed from the button click $BP = $ScriptArgs.EventArg1 ## Get a list of AppIds in the supplied Blueprint $appIds = Get-MSApplications -IdsOnly -BlueprintPath $BP ## Add Blueprint's AppIds to Users Add-MSApplicationLinksTo -AppIds $appIds -ToModule "UserMigrations" -ToIds $userIds ## Add Note to Users $noteToAdd = "Added App Links to User for all Applications in the Blueprint $BP" foreach($Id in $UserIds){ Add-MSUserMigrationNotes -id $Id -NoteText $noteToAdd }
- Click 'OK'
- Then click 'Save Changes'.
Step 5: Configure a UI Button
- Go to Administration\User Migrations\UI Buttons
- Scroll to the bottom of the existing button grid and click "Click here to add new item"
- Set the button label to "Add Blueprint Apps"
- Click the Sub-Button on the row you just created with "Add Blueprint Apps to users" on
- Add a button label "Add Account Apps to Users"
- Repeat 4 & 5 above until you have two more sub-buttons "Add Production Apps to users" & "Add Sales Apps to users"
- Set "Run Script" to "Link Users to Apps Via Blueprint"
- You can change button icons if you want, look for new icon names here, and type over the icon name on the grid.
- E.g. If we have the icon in ManagementStudio the picture will change. i.e.
- Make sure the new buttons are enabled
- Click the extra fields icon in the top right of the screen
- Enable the Args1 Checkbox
- Add the correct argument for each key
Step 6: Testing The User Module Grid
- Load the user module
- Right-click a user and select "Add Blueprint Apps" and select one of the sub buttons
- Apps will be added to the user and a note added to the user record.
Further Support
If you require further support, please visit ManagementStudio's Service Desk to search the knowledge base or create a new support ticket.