In the hash %info returned by Win32::Lanman::NetServerGetInfo($server, \%info, 1) there is a key 'type' that has a numeric value. This is a 32-bit bitstring, the bits of which denote the various types of server. These bits can be decoded by ANDing with the SV_TYPE_* constants that are exported by the module.

This script demonstrates how to get at the info. It a shame that the module doesn't export the vast array of constants as a hash in the first place, it would make using them a whole lot easier:)

#! perl -slw use strict; use Win32::Lanman; my %serverType = ( SV_TYPE_AFP => SV_TYPE_AFP, SV_TYPE_ALL => SV_TYPE_ALL, SV_TYPE_ALTERNATE_XPORT => SV_TYPE_ALTERNATE_XPORT, SV_TYPE_BACKUP_BROWSER => SV_TYPE_BACKUP_BROWSER, SV_TYPE_CLUSTER_NT => SV_TYPE_CLUSTER_NT, SV_TYPE_DCE => SV_TYPE_DCE, SV_TYPE_DFS => SV_TYPE_DFS, SV_TYPE_DIALIN_SERVER => SV_TYPE_DIALIN_SERVER, SV_TYPE_DOMAIN_BAKCTRL => SV_TYPE_DOMAIN_BAKCTRL, SV_TYPE_DOMAIN_CTRL => SV_TYPE_DOMAIN_CTRL, SV_TYPE_DOMAIN_ENUM => SV_TYPE_DOMAIN_ENUM, SV_TYPE_DOMAIN_MASTER => SV_TYPE_DOMAIN_MASTER, SV_TYPE_DOMAIN_MEMBER => SV_TYPE_DOMAIN_MEMBER, SV_TYPE_LOCAL_LIST_ONLY => SV_TYPE_LOCAL_LIST_ONLY, SV_TYPE_MASTER_BROWSER => SV_TYPE_MASTER_BROWSER, SV_TYPE_NOVELL => SV_TYPE_NOVELL, SV_TYPE_NT => SV_TYPE_NT, SV_TYPE_POTENTIAL_BROWSER => SV_TYPE_POTENTIAL_BROWSER, SV_TYPE_PRINTQ_SERVER => SV_TYPE_PRINTQ_SERVER, SV_TYPE_SERVER => SV_TYPE_SERVER, SV_TYPE_SERVER_MFPN => SV_TYPE_SERVER_MFPN, SV_TYPE_SERVER_NT => SV_TYPE_SERVER_NT, SV_TYPE_SERVER_OSF => SV_TYPE_SERVER_OSF, SV_TYPE_SERVER_UNIX => SV_TYPE_SERVER_UNIX, SV_TYPE_SERVER_VMS => SV_TYPE_SERVER_VMS, SV_TYPE_SQLSERVER => SV_TYPE_SQLSERVER, SV_TYPE_TERMINALSERVER => SV_TYPE_TERMINALSERVER, SV_TYPE_TIME_SOURCE => SV_TYPE_TIME_SOURCE, SV_TYPE_WFW => SV_TYPE_WFW, SV_TYPE_WINDOWS => SV_TYPE_WINDOWS, SV_TYPE_WORKSTATION => SV_TYPE_WORKSTATION, SV_TYPE_XENIX_SERVER => SV_TYPE_XENIX_SERVER, ); my $serverName = '\\\\YourServerName'; my %info; if( Win32::Lanman::NetServerGetInfo( $serverName, \%info, 1 ) ) { for( keys %serverType ) { print "$serverName is a $_" if $info{type} & $serverType{$_}; } } else { print "NetServerGetInfo error:$^E"; }

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller



In reply to Re: Remote Server Types by BrowserUk
in thread Remote Server Types by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.