Add Primary Users Email To Device Email

Modified on Thu, 30 Jun, 2022 at 10:55 AM


Overview

If a device has a user link set as "Primary" affinity, add the user's email to the device as the Primary Contact


Use Case

In a scenario where a device-based Deployment Units will be used, it's very useful to be able to email the devices. This can be

achieved if the device has a Primary Contact email address.


Solution

Look for the Primary User of each device. Add their email to the "Primary Contact" of each device


Usage

1.  Admin -> Devices -> Details Config -> make any available CustomProperty visible and change the order so that this appears near to the Primary Contact Email field

2.  Change the Display Name to "User First Name" -> Save Changes

3.  Make a note of which CustomProperty was used (eg. CustomProperty1)

4.  Admin -> Devices -> Powershell Scripts -> Devices -> Click here to add new item -> Script Name: "Machine Primary User"


5.  Edit script (scroll button) and copy/paste into the PowerShell Editor from this link


6.  In the second line of the script set $Device_FirstName = 'CustomProperty1' (custom property used in step 1)

7.  Click OK

8.  With the column picker turn on column Grant Access 2


9.  Add the Project Admin role to Grant Access 2 to enable the script to be manually run by admins



10. Click Save Changes

11. Scroll to the right and run the script


12. Open Devices -> All Devices. Open a device which has at least one user. Validate that the Primary User Email has been populated with the user's email address.

13. Admin -> Devices -> Powershell Scripts -> Devices -> Add a Schedule to the Schedule 1 column for that script


14. Click Save Changes

15. This script will then run automatically