Jump to content
Sign in to follow this  

WMI BCDstore

Recommended Posts


I am trying to open the operating system currently in use, using WMI .

Found this Autoit BCD and technet blog

Trying to do this 

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

Here is what I have, but the $obCurrent is not an object.

Const $BCDWindowsImageType = 0x10200003
Const $BCDLegacyImageType = 0x10300006
Const $BCDLibString_Desc = 0x12000004
Const $BcdOSLoaderDevice_OSDevice = 0x21000001
$Current = "{fa926493-6f1c-4193-a414-58f0b2456d1e}"

Local $WMILocator = ObjCreate("WbemScripting.SWbemLocator")

Local $WMIRootNameSpace = $WMILocator.ConnectServer(@ComputerName, "root\wmi")
Local $oStoreClass = $WMIRootNameSpace.Get("BcdStore")

Local $objInParam = $oStoreClass.Methods_('OpenStore').InParameters.SpawnInstance_()
$objInParam.Properties_.Item('File') = ""
Local $oBCDStore = $oStoreClass.ExecMethod_('OpenStore',$objInParam).Store   ;  The Store property contains our object value

If IsObj($oBCDStore) Then

        $obCurrent =$oBCDStore.OpenObject($Current)


I am not the best at Objects, so any help will be appreciated. 

Share this post

Link to post
Share on other sites


$Current = ObjGet("{fa926493-6f1c-4193-a414-58f0b2456d1e}")

in your script $current is a stringvariable no object, so $ObjCurrent is also a stringvar.

Edited by AutoBert

Share this post

Link to post
Share on other sites

thanks for your reply.

However,that did not work 

test.au3 (7) : ==> COM Error intercepted !
    err.number is:         0x800401E4
    err.windescription:    Invalid syntax

    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     10606000
    err.lastdllerror is:     2
    err.scriptline is:     7
    err.retcode is:     0x00A1D950


Edited by step887

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.