I take all the above back,...it worked. But only if I pass the domain name manually. $domain returned by Win32::DomainName is not correct (it is a valid domain) but its not the master domain.
Which brings me to the next question, how can obtain a list of available domains and how can I tell which is the master domain.
Many thanks once again.
Comment on Re: Re: Re: User group membership: bug in code
Actually DomainName is doing what you told it to do so it is correct.
As to a call to tell you what is the master domain of a series of domains. I don't think that exists. As AD comes into play you might see something down the road.
Besides what is wrong with feeding your script the master domain or the PDC of the masterdomain? Remeber the PDC is what the function call needs.