# ++++++++++++++++++++++++++++++++++++++++++ # NetFileEnum($server, $basepath, $user, \@info) # Supplies information about some or all open files on server \\testserver <\\testserver> . # Specify target computer as first argument (with or without preceding '\\') use Win32::Lanman ; $computer = "$ARGV[0]" ; $sessions_number = 0; $computer = substr($computer,2,) if (substr($computer,0,2) eq "\\\\") ; #print "------------[$computer]------------\n" ; if(!Win32::Lanman::NetFileEnum("\\\\$computer", '','', \@infos)) { print "Sorry, something went wrong; error: "; # get the error code print Win32::Lanman::GetLastError(); print " : $^E" ; exit 1; } foreach $info (@infos) { @keys = keys(%$info); #foreach $key(@keys) { # print "$key: ${$info}{$key}\n"; # } push @files,"${$info}{username} \t ${$info}{pathname}" ; } #print ${$info}{username} . "\t" if (@files eq () ) ; print join "\n",@files ; print "\n"; # ++++++++++++++++++++++++++++++++++++++++++