blackadder has asked for the wisdom of the Perl Monks concerning the following question:

Hi, me again, Can someone please tell me whats wrong with this simple code?
surely, I do not need to go and read volumes upon volumes of libraries and various Dave Roth books just to get this tiny code working?
ps: I tried '\\\\' and '\\' with the $PDC name, to no avail.
The error I get is "No such directory or file"?
Help please 'I have been tortured by PERL'
use strict 'vars'; use Win32::Lanman; use Win32::NetAdmin; my $name = Win32::LoginName(); my $domain = Win32::DomainName(); my $pdc; my @GlobalGroups; Win32::NetAdmin::GetDomainController('',$domain,$pdc); print "Name: $name,\tDomain: $domain,\tPDC: $pdc\n"; if (Win32::Lanman::NetUserGetGroups($pdc,$name,\@GlobalGroups)) { print "done\n"; }

edited: Thu Jun 27 14:20:36 2002 by jeffa - title misspelling correction and amendment

Replies are listed 'Best First'.
Re: User group membership: bug in code
by Marza (Vicar) on Jun 27, 2002 at 16:26 UTC

    Your code runs fine for me.

    Are you using an ID that has authority to access the DC?. Do you have the mods installed right? Do you have a NT setup or AD? Just some random ideas.

    Where does the error appear?

      Many thanks for your reply,..the @GlobalGroups doesn't get populated?? I was informed that I am a domain admin and i can map a drive to the $admin share on the PDC.
        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.