Mr. Mike Gibson's Cisco Info
Useful commands and SQL.
Useful CISCO command line commands
Favorite commands that can't be done in Web GUI

show commands:

Show CUBE commands

run sql commands:

Show CUPS commands for UC information

Show CUCM commands for phone ownership changes
Show CUCM commands for jabber information
Show CUCM commands for BLF phone information
Hide CUCM commands for phone information
List only Desk Phones with 82345 in description:
run sql select name,description,isactive from device where name like 'SEP%' and description like '82345%' order by description

Output will look something like this:
name            description     isactive
=============== =============== ========
SEPD0BEA963C5D6 82345 - Telecom t
SEP00235A17EF3C 82345 - Telecom t
List all Devices with a particular DN or ADN:
run sql select d.name,d.description,n.dnorpattern from device d inner join devicenumplanmap dmap on dmap.fkdevice=d.pkid inner join numplan n on dmap.fknumplan=n.pkid where n.dnorpattern='82345' order by d.name

Output will look something like this:
name            description          dnorpattern
=============== ==================== ===========
CSFmikebro      81234 - Telecom      81234
RDP_mikebro     81234 - Telecom      81234
SEP00235E17EF3C 81234 - Telecom      81234
SEP00270D3EC5EF 82392 - Telecom      81234
SEP44E4D9453B79 86014 - Telecom      81234
TABmikebro      81234 - Telecom      81234

List all DNs that have divert on:
run sql select dnorpattern,cfadestination,cfavoicemailenabled from callforwarddynamic c, numplan n where c.fknumplan = n.pkid and (cfadestination != '' or cfavoicemailenabled ='t')

Output will look something like this:
dnorpattern cfadestination cfavoicemailenabled
=========== ============== ===================
81875       94542107       f
83191       NULL           t
84304       88142          f
85371                      t
87180       87102          f
{continued}

List all DNs that are diverted off campus:
run sql select dnorpattern,description,cfadestination from callforwarddynamic c, numplan n where c.fknumplan = n.pkid and cfadestination like '9%'

Output will look something like this:
dnorpattern description         cfadestination
=========== =================== ==============
81234       81234 - Telecom     94544107
82345       82345 - Telecom     94527299
83456       83456 - Telecom     94544107
85678       85678 - Telecom     94544261
{continued}
List all devices with external mask values:
run sql select d.name,d.description, dmap.e164mask from device d, devicenumplanmap dmap where dmap.fkdevice=d.pkid and dmap.e164mask != ''

Output will look something like this:
name             description      e164mask
===============  ===============  ========
SEP64D814A4B410  85967 - Telecom  82611
SEP34BDC82CEFD0  85970 - Telecom  82611
SEP34BDC82CE14D  87425 - Telecom  82611
{continued}

List all directory numbers with internal mask values:
run sql select dnorpattern, description, callingpartytransformationmask from numplan where dnorpattern like "8%" and callingpartytransformationmask like "8%"

List all phones logged into huntgroup that belongs to a huntgroup:
run sql select lg.name LineGroup,n.dnorpattern,dhd.hlog from linegroup lg inner join linegroupnumplanmap lgmap on lgmap.fklinegroup=lg.pkid inner join numplan n on lgmap.fknumplan=n.pkid inner join devicenumplanmap dmap on dmap.fknumplan = n.pkid inner join device d on dmap.fkdevice=d.pkid inner join devicehlogdynamic dhd on dhd.fkdevice=d.pkid where dhd.hlog='t' order by lg.name

Output will look something like this:
linegroup         dnorpattern hlog
================= =========== ====
Telecom LG-85678  82228       t
Telecom LG-85678  88372       t
Telecom LG-85678  88542       t
{continued}
List all phones/devices beloning to a user:
select device.name, enduser.userid from device, enduser, enduserdevicemap where device.pkid=enduserdevicemap.fkdevice and enduser.pkid=enduserdevicemap.fkenduser and enduser.userid = 'tjgibso'

Output will look something like this:
  name            userid
=============== =======
SEP00777E17EF3C tjgibso
SEP00777E17EF3C tjgibso
SEP447779453B79 tjgibso
CSFtjgibso      tjgibso
IPCtjgibso      tjgibso
IPC_TSCForward  tjgibso

find phones with or without WebAccess turned on:
run sql SELECT Device.name,TypeModel.name,"Web Enabled" FROM Device,TypeModel,DeviceXml4k WHERE DeviceXml4k.fkDevice=Device.pkid AND Device.tkModel=TypeModel.enum AND xml LIKE "%0%"

run sql SELECT Device.name,TypeModel.name,"Web Disabled" FROM Device,TypeModel,DeviceXml4k WHERE DeviceXml4k.fkDevice=Device.pkid AND Device.tkModel=TypeModel.enum AND xml LIKE "%1%"
Show CDR commands for phone information

Show TABLE information