Everything I used to do with Win32::Lanman I now do with WMI using
Win32::OLE. I don't know what exactly Lanman::NetServerDiskEnum() returns,
but one way to enumerate the physical disks on a server is like this:

use Win32::OLE qw(in);

my $wmi = Win32::OLE->GetObject(
        
"winmgmts:{impersonationLevel=impersonate}!//COMPUTERNAME/root/CIMV2"
   ) or die Win32::OLE::LastError();

my $drives = $wmi->ExecQuery( "SELECT DeviceID, Caption FROM
Win32_DiskDrive" );

foreach $drive (in( $drives )) {
 print $drive->{Properties_}->{DeviceID}->{Value}.' : '.
       $drive->{Properties_}->{Caption}->{Value}."\n";
}

If you're looking for partition information, you can get that too with the
Win32_DiskPartition class.

Of course, WMI needs to be installed on the machine you're querying. I'm
pretty sure MS included it on all OSes after Win2K, and I think they
slipstreamed it into SP6 on NT if you're still running any of that.

HTH,
-Shawn


________________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Friday, September 08, 2006 2:18 PM
To: [EMAIL PROTECTED]
Cc: perl-win32-admin@listserv.ActiveState.com
Subject: RE: Lanman replacement?

Thanks for the reply, Mathew. 
After more testing, this seems to be an incompatibility with a legacy app
instead of WinXP. Unfortunately, I can't mod the other app so still must
find a workaround/replacement for the lanman module. I've temporarily
remarked out the die statement in lanman.pm but that is somewhat
bothersome.  If a runtime problem occurs, the end result is the same: it's
going to blowup either way!
All I need to do is enumerate (Lanman::NetServerDiskEnum) the local drives,
so a simple kludge might be necessary ;-) 
Thanks again, 
Sturdy 


_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to