TABLE OF CONTENTS
- Step 1 - Create the custom field in the User Migrations
- Step 2 - Create the PowerShell Script
- Step 3 - Configure the Survey
- Further Support
In this article, we will outline the steps required to setup a User Migration survey to allow the end-users to select their main device from a list of devices currently linked to their profile.
Step 1 - Create the custom field in the User Migrations
In this example, a custom field has been created within Administration ->User Migration->Discovery form(1).
The custom field can be created within any of the custom forms.
- Click New Field to add in the Customfield.
- Click Save Changes.
- Make a note of the Field id of the custom field – e.g 2437
Step 2 - Create the PowerShell Script
- Switch to Administration -> User Migrations –> PowerShell Scripts.
- Copy the following script and ensure the field id is amended to match the id noted in the previous step.
## Get Ids from Script Args
$userId = $ScriptArgs.items
$deviceId = $ScriptArgs.AltItems
## Get Hostname of selected Device
$hostname = Get-MSDevices -DeviceIds $deviceId | Select-Object -ExpandProperty Hostname -First 1
##Save Hostname to a Custom Field
Update-MSUserMigrationsCustomFields -FieldId 2437 -FieldInstanceId $userId -DataValue $hostname
- Click Save Changes.
- Make a note of the PowerShell script id. E.g 30
Step 3 - Configure the Survey
- Switch to Administration -> User Migrations ->Surveys (1).
- Select the desired survey from the survey dropdown menu (2).
- Click New Field (3) to add fields.
- Select Links-Devices (4) under the special control column.
- Enter the following in the Special Control Arg box(5):
Columns:HostName, DeviceType, Make, Model;
CustomButtonLabel: My Main Device;
CustomButtonStyle: btn-outline-info btn-sm;
- Ensure the CustomButtonScriptId is amended to match the script id noted earlier.
- Click New Field and select the CustomField (6) created within the custom form used to store the information.
- Click Save Changes to commit the changes (7).
Here’s the output on the Survey
When the User clicks on ‘My Main Device’ Button, it adds the hostname to the my Main Device custom field.
If you require further support, please visit ManagementStudio's Service Desk to search the knowledge base or create a new support ticket.