in reply to Win32:NetResource problem

Are you trying to get the UNC for mounted shares? I don't think it works for shares on your system. I tried getting the UNC for a local share. Nothing. Then I did externals; works fine.

use strict; use warnings; use diagnostics; use Win32::NetResource; my @oth_paths = ("J:\\activeperl", "R:\\McAfee"); map { my $outpath; print "in_UNC : $_ \n"; Win32::NetResource::GetUNCName ( $outpath , $_); print "out_UNC : $outpath \n"; } (@oth_paths);

Output:

Trying to get a local and an external share: D:\Sysad-perl\scripts\Reports\AntiVirus Status\TaskScheduler>prob in_UNC : D:\Public out_UNC : in_UNC : R:\McAfee out_UNC : \\Public\Depot\McAfee Getting two external shares: D:\Sysad-perl\scripts\Reports\AntiVirus Status\TaskScheduler>prob in_UNC : J:\activeperl out_UNC : \\Synnac2\pctools\activeperl in_UNC : R:\McAfee out_UNC : \\Public\Depot\McAfee

Replies are listed 'Best First'.
Re: Re: Win32:NetResource problem
by arkamedis21 (Acolyte) on Aug 08, 2002 at 18:25 UTC
    Yes, I am trying the GetUNCName() for local shares. Is there any other way to get the local share information through any other perl module, or windows system commands.

    Thanks.
      From the Win32::NetResource docs...
      use strict; use Win32::NetResource qw(:DEFAULT GetSharedResources GetError); if (GetSharedResources(my $resources, RESOURCETYPE_ANY, { RemoteName => "\\\\" . Win32::NodeName() })) { foreach my $href (@$resources) { print "-----\n"; foreach(keys %$href) { print "$_: $href->{$_}\n"; } } }

      is this what you are looking for?

      -Waswas