Product Documentation

Tagging User Devices Automatically

Dec 21, 2015
You can tag your users' devices as either corporate-owned or employee-owned to keep track of your company's Bring Your Own Device (BYOD) program, either automatically with a script, or manually by using the Device Manager web console. To enable employee and corporate device tagging, you will need to download a Microsoft PHP, add device IDs to a CSV file, and execute the given XenMobile scripts that will automate the device tagging process. After setting up the device tagging, you will schedule the script as a repeating Windows Task to run every minute.
Note: For on-premise deployments, the tagDevices.php script is located at C:\Program Files (x86)\Citrix\XenMobile Device Manager\samples\WebServices.

To set up device tagging

  1. In a browser, go to the Windows PHP download site at http://windows.php.net/download/.
  2. Download the installer package named php 5.3 (VC9 x86 Thread Safe (2012-Feb-02 21:56:19).
  3. Install the package on your local system at c:\php5.
  4. Copy the two files named tagDevice.php and devices.csv to c:\temp (this PHP script is host, location and platform agnostic).
  5. Open the tagDevice.php file in a text editor and replace the default information (highlighted) with the following parameters:
    • For an on-site Device Manager implementation:
      $soap_url = "<servername>/zdm/services/EveryWanDevice?wsdl"  
      $client = new SoapClient(null, array( 
      'location' => $soap_url, 
      'url' => "<servername>", 
      'login' => "demo", 
      'password'=> "XXXXX")); 
      For example:
      $soap_url = "mdm.zenprise.com/zdm/services/EveryWanDevice?wsdl" 
      $client = new SoapClient(null, array( 
      'location' => $soap_url, 
      'url' => "mdm.zenprise.com", 
      'login' => "demo", 
      'password'=> "XXXXX")); 

      where mdm.zenprise.com is the name of the Device Manager server and zdm is the Device Manager instance name.

    • For a cloud deployment ​implementation:
      $soap_url = "<instance>.zc.zenprise.com/<instance>/services/EveryWanDevice?wsdl"; 
      $client = new SoapClient(null, array( 
      'location' => $soap_url, 
      'url' => "<instance>.zc.zenprise.com", 
      'login' => "demo", 
      'password'=> "XXXXX")); 
      For example:
       
      $soap_url = "abc.zc.zenprise.com/abc/services/EveryWanDevice?wsdl"; 
      $client = new SoapClient(null, array( 
      'location' => $soap_url, 
      'url' => "abc.zc.zenprise.com", 
      'login' => "demo", 
      'password'=> "XXXXX")); 
      
  6. Edit the devices.csv file and add the serial numbers of all corporate devices, on separate lines.
  7. Open a DOS command prompt and cd to c:\temp and run the following command tagDevice.php as follows:
    c:\temp>c:\php5\php.exe tagDevice.php 
    device:7R043870A4S is a personal asset 
    device:82835PLWY7K is a personal asset 
    device:88025X9PA4T is a personal asset 
    device:880277VSA4S is a personal asset 
    device:99000052027603 is a personal asset 
    device:A1000013555FD9 is a personal asset 
    device:A10000138B2613 is a personal asset 
    device:A1000017B0A311 is a personal asset 
    device:C329030326CC33E is a corporate asset 
    device:GB0262YCETV is a personal asset 
    device:GB0289L3ETV is a personal asset 
    c:\temp>

To configure a device tagging script to run as a repeating task

  1. Create a file named tagDevice.cmd under c:\temp (where you previously had copied tagDevice.php and devices.csv) and add the following line: cd c:\temp && c:\php5\php.exe tagDevice.php
  2. Create an MS Scheduled task to execute this command once every minute (/MO 1). For example: c:\> schtasks /create /TN tagDevice c:\temp\tagDevice.cmd /MO 1
  3. Query the tasks to verify that it exists by executing the following command: c:\ schtasks /query /TN tagDevice
  4. To delete the task, execute this command: c:\ schtasks /delete /TN tagDevice