http://www.perlmonks.org?node_id=996589

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

I am trying to use Win32::Lanman for checking connection to a fileshare on windows. The name of the file share is \\10.95.206.110\filessytem\data. Now i use the following function given NetShareCheck as follows

my $type; if(!Win32::Lanman::NetShareCheck("\\\\10.95.206.110","\filessytem\data +", \$type)) { print "Sorry, something went wrong; error: "; # get the error code print Win32::Lanman::GetLastError(); }

It gives an error that it is not correct usage. When i see fuctions usage it shows that i need to specify a drive on the server but i only have the server address and fileshare name , there is no drive involved. How can i make this function work?

Replies are listed 'Best First'.
Re: Lanman Netshare
by BrowserUk (Patriarch) on Oct 01, 2012 at 07:05 UTC

    You forgot to double your backslashes: "\filessytem\data".


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

      Now it get Sorry something went wrong ; error:2311

        Error 2311 translates to:

        C:\test>perl -E"say $^E=2311" This device is not shared

        What do you get if you try?:

        net use z: \\10.95.206.110\filessytem\data

        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        RIP Neil Armstrong