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

In the NT4 world, I could enumerate servers with this:
Win32::NetAdmin::GetServers($server, $domain, SV_TYPE_SERVER, \@server +Array);
But when I try this against a Win2K DC, it almost never works (once in a while it will - without any changes to the code mind you). Is there a "more proper" way of doing this in Win2K, or is there a new function that will always work against either type of domain? Thanks

Replies are listed 'Best First'.
(tye)Re: Howto enumerate servers in a Win2K domain?
by tye (Sage) on Feb 18, 2002 at 15:19 UTC

    I'd ask you why it was failing and why you weren't reporting the error code when it fails. Unfortunately, Win32::NetAdmin::GetServers() makes it impossible to do this. The routine for GetServers in NetAdmin.xs needs to do     if( 0 != lastError ) SetLastError(lastError) at the end. Similar changes are probably also required in other routines there.

    If you want to get to the bottom of this, I suggest you grab the source code to the module (or to the libwin32 bundle), make that patch, then report $^E upon failure.

    Please submit the patch back to the module/bundle maintainer. Thank you.

            - tye (but my friends call me "Tye")