I'hope that this script helps you!
-----------------------------------------------------------
DECLARE @Group varchar(100)
Set @Group = '[My group SQL] or [MY domain\My Group Win]'
declare @Type char(1),@Name varchar(100), @Owner varchar(100)
declare Lista cursor for
Select 'P',...