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

I've been looking around for a method to read the registry from remote Windows machines running XP and Win2003. I first tried Hardware/Software Inventory and that works great if the credentials on both machines match but I need to be able to specify unique credentials for each machine. I've looked at Win32::OLE and Win32::TieRegistry, and http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_vzbp.mspx?mfr=true. I didn't see anything that would help or if the answer is there it's most likely above my current skill level.

After trying a few other examples I stumbled on Win32::Lanman that might work but I get this message  Error installing package 'Win32-Lanman': Read a PPD for 'Win32-Lanman', but it is not intended for this build of Perl (MSWin32-x86-multi-thread-5.10) . I'm using strawberry Perl 5.10.0 on XP.
There's a thread http://www.mail-archive.com/perl-win32-users@listserv.activestate.com/msg37524.html that indicates Win32::Lanman needs to be updated and there's a volunteer, but I don't see anything more recent. There are instructions for compiling it using MSVC++ but I'm afraid that would become a second career before I got it figured out.

Are there any other ideas for getting at the remote registry or something I've missed?

  • Comment on Error: Read a PPD for 'Win32-Lanman', but ..not intended ..for this build (MSWin32-x86-multi-thread-5.10)
  • Download Code

Replies are listed 'Best First'.
Re: Error: Read a PPD for 'Win32-Lanman', but ..not intended ..for this build (MSWin32-x86-multi-thread-5.10)
by xiaoyafeng (Deacon) on Apr 26, 2009 at 03:27 UTC

    It appears you download other version module(not 5.10.0) There is two ways to solve:

    1. go here to install module
    2. open win32-lanman.ppd by a text editor, change version 5.8.8 to 5.10.

    HTH.


    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

      2. open win32-lanman.ppd by a text editor, change version 5.8.8 to 5.10.

      That would allow the module to install, but Win32::Lanman would still be unusable (because of binary incompatibility). If Win32::Lanman were a pure perl module, then there may be no problems with that suggestion - but, unfortunately, Win32::Lanman contains code that needs to be compiled and is not pure perl .

      If there's a ppm package for it at the trouchelle repo, then that would be the best shot.
      Although Jan was initially going to pick up this module, he was deterred by the restrictive GPL license. I don't know if anyone is doing anything with it.

      Cheers,
      Rob
Re: Error: Read a PPD for 'Win32-Lanman', but ..not intended ..for this build (MSWin32-x86-multi-thread-5.10)
by NetWallah (Canon) on Apr 26, 2009 at 15:29 UTC
    You may want to look at some ready-made code, here in the Code Catacombs, NT Admin section:
    Hardware/Software Inventory by shonorio.

    Some code from the XP cookbook may help:

    # From the book "Windows XP Cookbook" # ISBN: 0596007256 # Note that you cannot use this to connect to the local machine. # ------ SCRIPT CONFIGURATION ------ use Win32::OLE; $strServer = '<HostName>'; # e.g. wks01 $strUser = '<User>'; # e.g. AMER\rallen.adm $strPasswd = '<Password>'; # ------ END CONFIGURATION --------- $objLocator = Win32::OLE->new('WbemScripting.SWbemLocator'); $objWMI = $objLocator->ConnectServer($strServer, 'root\\cimv2', $strUs +er, $strPasswd); if ((0 + Win32::OLE::LastError()) != 0) { print 'Authentication failed: ' . ('' . Win32::OLE::LastError()), +"\n"; } # Now you can use the objWMI object to get an instance of a class # or perform a WQL query. Here is an example: $colDisks = $objWMI->InstancesOf('Win32_LogicalDisk')->Item;

         ..to maintain is to slowly feel your soul, sanity and sentience ebb away as you become one with the Evil.

      Thanks for the tip NetWallah. Unfortunately I'm not having much luck with this example. I get a  Use of unintialized value $colDisks in concatenation (.) or string at line 27.error. I did get one of the examples to work so it's not all bad. I think I'll need to suck it up and study COM and/or Windows scripting stuff for a while to understand what WMI and SWbemServices are. Maybe then I'll have a clue.

      If anyone reading this might have a tip for a good book on this, that would be good. I'm not a programmer(Yet. That's why I'm studying Perl) so I assume it would have to be VB, VBscript, or something basic like that. As opposed to .net?