Referring to my previous post:
http://pandaeatsbamboo.blogspot.hk/2014/01/associate-existing-phones-to-users-with.html
I have created a shell script that allow us to update the owner ID to phone in batch.
http://pandaeatsbamboo.blogspot.hk/2014/01/associate-existing-phones-to-users-with.html
I have created a shell script that allow us to update the owner ID to phone in batch.
bulk-update.sh, change with your UCM ip address and credential in the curl statement.
#!/bin/sh
for i in `less user-phone-list.txt`
do
#echo $i
username=`echo $i | cut -d ',' -f1`
devicename=`echo $i | cut -d ',' -f2`
cat <<EOF1 >$username.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
<soapenv:Header/>
<soapenv:Body>
<ns:executeSQLUpdate sequence="?">
EOF1
echo "<sql>update Device set fkenduser = ( select pkid from EndUser where userid = '$username') where name = '$devicename'</sql>" >>$username.xml
cat <<EOF2 >>$username.xml
</ns:executeSQLUpdate>
</soapenv:Body>
</soapenv:Envelope>
EOF2
curl -k -u administrator:ccievoice -H "Content-type: text/xml;" -H "SOAPAction: CUCM:DB ver=8.5" -d @$username.xml https://10.1.90.11:8443/axl/
done
user-phone-list.txt, file contains username and device name pair with comma as delimiter, put them in the same directory as the script.
dannywon,SEPAABBAABBAABB
briacho,SEP00077DDFFB7E