in reply to Perl - WMI - BCD

Yup. $wmi is undef so Win32::OLE->GetObject failed. Check that the contents of $class is correct.

Update: the following test code works for me:

use strict; use Win32::OLE; use warnings; my $wmi = Win32::OLE->GetObject('winmgmts:!\\\\localhost\root\default' +); print "Got a wmi object" if defined $wmi;

Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^2: Perl - WMI - BCD
by ChrisLD (Initiate) on Jul 08, 2008 at 01:18 UTC
    If I dump the value of $wmi It shows the expected information from wmi:bcdstore
    $VAR1 = bless( { 'Qualifiers_' => bless( { 'Count' => 3 }, 'Win32::OLE' ), 'Properties_' => bless( { 'Count' => 1 }, 'Win32::OLE' ), 'Methods_' => bless( { 'Count' => 15 }, 'Win32::OLE' ), 'Derivation_' => undef, 'Path_' => bless( { 'Path' => '\\\\V-CHRDIE1\\ROOT\\w +mi:BcdStor e', 'RelPath' => 'BcdStore', 'Server' => 'V-CHRDIE1', 'Namespace' => 'ROOT\\wmi', 'ParentNamespace' => 'ROOT', 'DisplayName' => 'WINMGMTS:{authe +nticationL evel=pktPrivacy,impersonationLevel=impersonate,(Backup,Restore)}!\\\\V +-CHRDIE1\\ ROOT\\wmi:BcdStore', 'Class' => 'BcdStore', 'IsClass' => 1, 'IsSingleton' => 0, 'Keys' => bless( { 'Count' => 0 }, 'Win32::OLE' +), 'Security_' => bless( { 'Imperson +ationLevel ' => 3, 'Authenti +cationLeve l' => 6, 'Privileg +es' => ble ss( { 'Count' => 2 }, 'Win32::OLE' ) }, 'Win32:: +OLE' ), 'Locale' => '', 'Authority' => '' }, 'Win32::OLE' ), 'Security_' => bless( { 'ImpersonationLevel' => 3, 'AuthenticationLevel' => 6, 'Privileges' => bless( { 'Cou +nt' => 2 }, 'Wi +n32::OLE' ) }, 'Win32::OLE' ), 'SystemProperties_' => bless( { 'Count' => 10 }, 'Win32::OLE' ) }, 'Win32::OLE' );