Skip to content
Start » Blog » Scripts

XenMobile Script: Set all unknown ownership devices to BYOD

A friend wanted to know how he can change the ownership of devices for an existing XenMobile Deployment.

This scripts sets all devices, which don’t have any ownership assigned (aka „unknown“), to BYOD devices.

#Parameter
#Server address
$xmserver = "hostedXenMobileAT.vsqloud.de"

#Module https://github.com/wvanbesien/XenMobileShell
Import-Module XenMobileShell

#Request Credentials
$credentials = Get-Credential

#Connecto to Server
$xmsession = new-XMSession -credential $credentials -server $xmserver -port 4443

#Load all devices
$xmdesvices = get-XMDevice

#loop though devices
foreach ($xmdevice in $xmdesvices){
    
    #get properties
    $xmdeviceproperty = get-XMDeviceProperty -id $xmdevice.id

    #extract ownership
    # no value = ownership not set
    # 0 = ownership is BYOD
    # 1 = ownership is COORP
    $xmdeviceownership = $xmdeviceproperty | where {$_.Name -eq "CORPORATE_OWNED"}
 
 
    
    if (!($xmdeviceownership)){
        Write-Host "ID  $($xmdevice.id), Username $($xmdevice.userName) Serial: $($xmdevice.serialNumber) has no Owner attribute, setting to BYOD" -ForegroundColor Yellow
        set-XMDeviceProperty $xmdevice.id  -name "CORPORATE_OWNED" -value "0" -Confirm:$false
    }

}

 

MS
Mauricio Schäpers
VS Qloud Solution

Schreibt im VSQloud-Blog von Technikern für Techniker über Citrix, Endpoint Management und den Betrieb hochverfügbarer Cloud-Infrastrukturen.

An den Anfang scrollen
Translate »
No results found...