jpavel has asked for the wisdom of the Perl Monks concerning the following question:
From all the <gag> VBS </gag> code I can gather from other sources, the constants that the first field accepts are:@host = ($server,"root/default",$user,$password); $localWMI = Win32::OLE->new('WbemScripting.SWbemLocator') or die "Cann +ot access WMI on local machine: ", Win32::OLE->LastError; $WMI = $localWMI->ConnectServer(@host) or die "Cannot access WMI on re +mote machine: ", Win32::OLE->LastError; $registry = $WMI->Get("StdRegProv") or print "Failed to get registry." +; my $err = Win32::OLE->LastError(); if ($err == 0) {print "Successful!\n";} else {print $err;} $base = "Software\\"; $registry->EnumKey('H80000002', $base, @result); my $err = Win32::OLE->LastError(); if ($err == 0) {print "Successful!\n";} else {print $err;}
Const HKEY_LOCAL_MACHINE = &H80000002
(ref: Microsoft's site...)
No matter how I try to set the variable, I always get: OLE exception from "SWbemObject": Type mismatch Win32::OLE(0.1502) error 0x80041005 in METHOD/PROPERTYGET "EnumKey"
Anybody know the correct format to pass a hexadecimal value to an OLE method call???
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pass Hexadecimal through OLE method?
by zakb (Pilgrim) on Mar 26, 2003 at 16:07 UTC | |
by jpavel (Sexton) on Mar 26, 2003 at 16:20 UTC |