Connecting to the server - wvanbesien/XenMobileShell GitHub Wiki
To connect to the server, create a session as in this example:
new-xmsession -user "admin" -password "password" -server mdm.someserver.com
This will connect to the API on port 4443, using the specified username and password. The username needs to have API access and will only be able to run those commands that it has permission to run. You can manage that through the RBAC settings in the XMS server.
As of version 1.2.0 you can also use a PScredential object. The credential object has the benefit of not requiring you to store the password in clear text in a script, or to enter it on a command line that can be read by others.
To use a PScredential object, do the following:
$credential = get-credential
new-xmsession -credential $credential -server mdm.someserver.com
You can further shorten that to:
new-xmsession -credential (get-credential) -server mdm.someserver.com