So, to be clear, you want a script to check each port to see if an EDP neighbor is found, and if not, to "disable EDP" on that port. You then want a script to discover which ports are participating in sharing, and then "configure trusted-ports {ports} trust-for dhcp-server" on the master port. Presumably, you also want to "enable ip-security dhcp-snooping vlan..." on the ports not sharing nor having any EDP neighbor, correct? The last bit will require finding out the VLANs on those ports to enable dhcp-snooping on them. Is this an accurate summary? Will you be loading this script on each edge-switch only once?