ChrisLD has asked for the wisdom of the Perl Monks concerning the following question:
My attempt to transfer into Perl which is not working.Const BcdLibraryString_Description = &h12000004 Const Current = "{fa926493-6f1c-4193-a414-58f0b2456d1e}" strComputer = "." Set objStoreClass = GetObject("winmgmts:{(Backup,Restore)}\\" & _ strComputer & "\root\wmi:BcdStore") objStoreClass.OpenStore "", objStore objStore.OpenObject Current, objDefault objDefault.GetElement BcdLibraryString_Description, objElement Wscript.Echo "Current operating system: " & objElement.String
Am I missing something obvious?use strict; use Win32::OLE; use Data::Dumper; use warnings; my $BcdLibraryString_Description = "&h12000004"; my $Current = "{fa926493-6f1c-4193-a414-58f0b2456d1e}"; my $strComputer = "\\\\localhost"; my $root = "\\root\\wmi:BcdStore"; my $class = ("winmgmts:{impersonationlevel=impersonate,(Backup,Restore +)}$strComputer$root"); my $wmi = Win32::OLE->GetObject($class); $wmi->OpenStore("", my $bcdst) or die "failed to get bcd"; #Also tried my $setopenstore = $wmi->OpenStore("",my $bcdst); $bcdst->OpenObject($Current, my $defaultclass ) or die "failed to open +object"; #Failing Point “Can't call method "OpenObject" on an undefined value at ASR_test2.pl” It looks like the previous line openstore is not assigning the store to $bcdst #Also tried my $setdefaultclass = $openstore->OpenObject($Current, my +$defaultclass); $defaultclass->GetElement($BcdLibraryString_Description, my $debugstat +us); print "\n$debugstatus\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl - WMI - BCD
by GrandFather (Saint) on Jul 08, 2008 at 01:00 UTC | |
by ChrisLD (Initiate) on Jul 08, 2008 at 01:18 UTC | |
|
Re: Perl - WMI - BCD
by ww (Archbishop) on Jul 08, 2008 at 01:44 UTC | |
by GrandFather (Saint) on Jul 08, 2008 at 02:19 UTC | |
by ChrisLD (Initiate) on Jul 08, 2008 at 01:54 UTC | |
by ww (Archbishop) on Jul 08, 2008 at 09:43 UTC |