From http://community.spiceworks.com/scripts/show/1872-get-user-group-memberships