Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Checking status of Network Mapped Drives

by AltBlue (Chaplain)
on Aug 04, 2008 at 10:59 UTC ( [id://702025]=note: print w/replies, xml ) Need Help??


in reply to Checking status of Network Mapped Drives

If all you really want it's to *check* the connection status, I'd avoid using such an approach because it's slow and auto-vivifying (Windows tries to activate each connection you want to read from).

IMHO a better way would be to query the Windows Management Instrumentation (WMI) infrastructure through DBD::WMI:

use strict; use warnings; use DBI; my $dbh = DBI->connect('dbi:WMI:'); my $sth = $dbh->prepare(<<'WQL'); SELECT * FROM Win32_NetworkConnection WHERE ConnectionState != 'Connected' WQL $sth->execute() or die $dbh->errstr; while (my ($con) = $sth->fetchrow_array) { printf "%s\t%s\n", $con->ConnectionState, $con->Name; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://702025]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-19 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found