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

Thanks to one of our bretheren I've now managed to install Win32::AdminMisc - Thanks again Rob - however when I run it I'm getting an error indicating a dll is missing. Is there a way of tracking down this dll and installing it for those of us that think Windows are for looking through!? For those of an inquisitive nature, at this point in time all I'm trying to do is resolve the IP addresses for DNS entries. This is part of a 900 PC upgrade that our Support people normally do but due to a bereavement and an employee leaving there is no-one else to look at this so being an inquisitive sort (and being someone that using Perl on UNIX platforms) I got lumbered! Unfortunately the timescale for this task is very short. The code I'm using - pinched from one of Dave Roth's books is :-
#!/usr/bin/perl -w use strict ; use Win32::AdminMisc ; # S C A L A R S #----------------# my $hostname = undef ; my $ipAddress = undef ; my $Ifile = "c:\\Perl\\RC\\PC_List\.txt" ; # A R R A Y S #-------------# my @fields = () ; # # P R O C E S S I N G #---------------------# open IPF, "<$Ifile" or die "\n\tCan't open $Ifile :: $!\n" ; while (<IPF>) { chomp ; @fields = split /\|/, $_ ; $hostname = $fields[0] ; print "\n\tProcessing PC $hostname\n" ; if ( $ipAddress = Win32::AdminMisc::GetHostAddress($hostname) ) { print "\n\tThe Ip address for $hostname is $ipAddress\n" ; } else { print "\n\tUnable to resolve IP address for $hostname\n" ; } } close IPF or die "\n\tCan't close $Ifile :: $!\n" ;
When I try and run this now it complains with the following (in a windows box):-
This application has failed to start because MSVCR70.dll was not found. Re-installing the application may fix this problem.

On the command prompt window the following appears:-
Can't load 'C:/Perl/site/lib/auto/Win32/AdminMisc/AdminMisc.dll' for m +odule Win3 2::AdminMisc: load_file:The specified module could not be found at C:/ +Perl/lib/D ynaLoader.pm line 230. at C:\Perl\RC\Get_PC_IP.pl line 4
Now unless windows is case sensitive the AdminMisc.DLL is exactly where it says it can't find it! Any help would be most appreciated. Thanks

Replies are listed 'Best First'.
Re: Win32::AdminMisc Problems
by doowah2004 (Monk) on Oct 18, 2006 at 16:56 UTC
    You can download the missing dll here. Then place the file in your perl/bin directory. Since you are using some flavor of unix, i am uncertain that it will work, but it is a quick check.

    Good Luck!
Re: Win32::AdminMisc Problems
by syphilis (Archbishop) on Oct 18, 2006 at 23:28 UTC
    Now unless windows is case sensitive the AdminMisc.DLL is exactly where it says it can't find it

    Aaaah ... but it didn't say it couldn't find it. It said it couldn't load it - and that happened because of the missing msvcr70.dll.

    The advice of doowah2004 should fix the problem - though the dll can be installed anywhere in your path (doesn't have to be the perl/bin).

    Cheers,
    Rob
      Agreed, but just downloading a DLL to overcome an error is a bad idea, it's better to let some supported package install it.

      The better way to resolve this one is to read:

      http://support.microsoft.com/kb/326922/en-us

      The proposed download the DLL and put it somewhere might actually help in that it may minimize the risk of bit-rot, but it does so at the price of missing security updates. My advice is to deal with the bit-rot and not compromise security in something that's used to administer 900 machines.

Re: Win32::AdminMisc Problems
by ww (Archbishop) on Oct 18, 2006 at 19:38 UTC
    I'm a tad confused.

    you say first that the windows error refers to MSVCR.dll (handles C's printf(), etc) but then tell us that from "the command prompt window" you're seeing an error related to Win32::AdminMisc but that that dll is where you expect to find it.

    The use Win32::AdminMisc line doesn't refer (directly) to a dll. It refers to a module.

    And the module, which appears to be homepaged at Roth Consulting comes with some warnings...

    What is this Parse Exception error all about?
    The ActiveState builds occasionally change the way extensions internally work. This causes a problem when you are attempting to load an extension designed for, let's say, build 303 into build 306. If you tried to do this you would get an error message indicating that a "parse exception" has occurred.
    The easy way to contend with this is to either...
    # recompile the extension with the headers for your build of Perl OR
    # download a build of the extension that matches your build of Perl.
    You will need to know which build of Win32 Perl you are using.
    The rule of thumb is you want to use the build that is closest or earlier than your current build. So if you are using build 313 then you want to download AdminMisc_Build_311.zip since there are none for 313 or 312. (This is because all three of these builds are compatible with each other)
    The AdminMisc_Build_xxx.zip is a replacement for the AdminMisc.PLL file. You need to download and install the entire package then, if you need it, download the specific build.
    The package and builds are available from our FTP site as ftp://ftp.roth.net/pub/ntperl/adminmisc/20030714/
    There are a few incompatibilities between (perl) build 313 and any remotely-current build, so this may have some relevance.
Re: Win32::AdminMisc Problems
by bingos (Vicar) on Oct 19, 2006 at 10:39 UTC

    I recently came across the same problem whilst reinstating an old script that we use for polling Windows boxes for their diskspace.

    I also tried installing the missing DLL, which didn't solve the problem. In the end I rewrote my script to use Win32::DriveInfo instead.

    I'd suggest not bothering with Win32::AdminMisc and use Net::DNS and even the built-in function gethostbyname.

    use strict; use warnings; use Socket; my $Ifile = 'c:/Perl/RC/PC_List.txt'; # P R O C E S S I N G #---------------------# open IPF, "<$Ifile" or die "\n\tCan't open $Ifile :: $!\n"; while (<IPF>) { chomp; my @fields = split /\|/, $_; my $hostname = $fields[0]; print "\n\tProcessing PC $hostname\n"; if ( my $ipAddress = gethostbyname( $hostname ) ) { print "\n\tThe Ip address for $hostname is", inet_ntoa( $ipAddre +ss ), "\n" ; } else { print "\n\tUnable to resolve IP address for $hostname\n" ; } } close IPF or die "\n\tCan't close $Ifile :: $!\n" ;

    I never used to have any trouble with Win32::AdminMisc when using ActiveState's Perl 5.8.7, I suspect it is an incompatibility with their 5.8.8 builds