Hi,

Again Johan the author at 365lab.net wrote a nice script.

It will change user license based on AD Group Membership.