$uri = "https://$tcxurl/xapi/v1/Users?`$filter=startsWith(Number,'HD')&`$count=true&`$orderby=Number&`$select=IsRegistered,CurrentProfileName,Id,Number,HotdeskingAssignment&`$expand=Phones(`$select=MacAddress,Name,Settings(`$select=IsSBC,ProvisionType))"
$tcxhdphones = (Invoke-RestMethod -uri $uri -headers $headers -Method GET -ContentType "application/json").Value
foreach( $tcxhdphone in $tcxhdphones ) {
$uri = "https://$tcxurl/xapi/v1/Users($($tcxhdphone.Id))?`$select=Phones,Number,AuthID,AuthPassword,DeskphonePassword&`$expand=Phones"
$tcxhdphonedata = Invoke-RestMethod -uri $uri -headers $headers -Method GET -ContentType "application/json"
$tcxhdphonedata.Phones.Settings.XferType = "AttXfer"
$tcxhdphonedata.PSObject.Properties.Remove('@odata.context')
$patchdata = $tcxhdphonedata | convertTo-Json -depth 10
Invoke-RestMethod -uri "https://$tcxurl/xapi/v1/Users($($tcxhdphone.Id))" -headers $headers -Method PATCH -body $patchdata -ContentType "application/json"
}