Creating an enrollment invitation - wvanbesien/XenMobileShell GitHub Wiki
The new-xmenrollment command allows you to create an invitation. This command has a lot of parameters, most of them optional.
new-xmenrollment -user <username> -os iOS -mode classic -ownership BYOD
Above command will create a simple enrollment invitation of the user
Parameters:
-
user: this is either the UPN or the sAMAccountName of the target user. This depends on the LDAP configuration of the server. Mandatory
-
OS: supports following values: iOS (Apple), SHTP (Android). Mandatory
-
phoneNumber: specify the phone number in case you want to send notifications. This is optional.
-
carrier: specify the carrier in case this is configured and used for SMS notifications. optional
-
deviceBindingType, deviceBindingData. The device binding type and data allow you to link the invitation to a particular device. You can use either SERIALNUMBER (default), IMEI or UDID (the type), and specify the value (data). optional.
-
ownership: specify if the device is corporate owned, employee owned or unknown. Values are: CORPORATE, BYOD, NO_BINDING. Mandatory
-
mode: specifies the type of enrollment invitation you want to create. The default is classic, other values are high_security, invitation, invitation_pin, invitation_pwd, username_pin, two_factor. The actual settings of each enrollment mode are configured on the server.
-
agentTemplate: if you want to send a notification, you will need to specify a template for that notification. The agent template is the message that is sent to help the users download Secure Hub. This value is case sensitive and having a typo in the name will make the request fail. To find the correct name, go to the notification template settings on the server. Similarly, if you create an enrollment invitation in the GUI, you can select and see the valid options.
-invitationTemplate, pinTemplate, confirmationTemplate. Same story as for the agent Template, however the invitation template contains the URL, and the pin Template the one time passcode. All of these are optional. The default is blank unless you specify this value.
This being powershell, you can pipeline information into this command. For example, say you create a long CSV file where you specify the usernames (upn), OS, phone number, ownership etc). The CSV file is called users.csv.
import-csv -path users.csv | %{ new-XMEnrollment -user $_.upn -os $_.os -ownership $_.ownership -phoneNumber $_.phoneNumber -notifyNow "true" -force}
Note: The template for agent notifications is different for iOS and android devices. Hence, if you want to use the templates, my suggestion would be to create a CSV file for iOS and another one for Android and import them that way.
Also, note in the above example, I added the -force switch, otherwise you have to confirm each individual enrollment. You can pipeline without %{}, in that case, the column headers in the csv file must have the same name as the parameter.