vbscript - Unable to set DeviceElements for a Windows BCD with WMI -
I am trying to create a Windows 7 BCD Store programmatically using a VBScript. Self storage, bootarm, and OS loader are seen floating because popularizing most elements for each object, where I go into trouble, there is a need to popularize devices and OSDIVE elements. Here is the code that works:
Constant BootMgrId = "{9dea862c-5cdd-4e70-acc1-f32b344d4795}" BootLdrId = Left (. CreateObject ("Scriptlet.TypeLib") Guid, 38 ) Set objStoreClass = GetObject ("winmgmts: {{backup, restore}} \\ \ root \ wMI: bcdstore.") ObjStoreClass.CreateStore "meter: \ boot \ bcd", objStore objStore.CreateObject BootMgrId, & amp; H10200002, objBootMgr objStore .CreateObject BootLdrId, & amp; H10200003, OzbutLDR OzbutLDRStr String Element and H12000002, "\ Windows SystemOver \ Boot \ Windle. OSAJ" OzbutLDRStr String Element and H12000004, "Diskwipe" OzbootLDRSrT String Element and H22000002, "\ Windows" OzbootelDru SToBean Element and H.2600022, True
The code I am having trouble with is:
objBootMgr.SetPartitionDeviceElement & h11000001, 2, "", "M:" objBootLdr.SetPartitionDeviceElement & amp; H11000001, 2, "", "m:" objBootLdr.SetPartitionDeviceElement & amp; I have tried some variations on the partition, at the end of the statement, the Windows Device device to include device device, such as win32_Volume, h21000001, 2, "", "m:"
The old boot.ini-style ARC path, "Partition =", and other syntax seems to be what works in bcdedit.
The final goal is to use another partition on the same physical disk, I do not believe that SetPartition is the correct way to use DewiceElement (this seems especially for the benefit of vhds) then Instead, I use:
objBootMgr.SetDeviceElement & amp; H11000001, 1, "" objBootLdr.SetDeviceElement & amp; H11000001, 1, "" objBootLdr.SetDeviceElement & amp; H21000001, 1, ""
Device and OSDView elements are properly populated and reflects the current boot partition, but when I change the active partition to partition, then this The new BCD is on and the reboot, thank you error, it does not boot, it is not surprising because this method does not allow the specification of a particular partition. I use it by using bcdedit
bcdedit -store m: \ boot \ bcd -set {bootmgr} device partition = m:
Pre>and
bcdedit -store m: \ boot \ bcd -set% guid% osdevice partition = m: bcdedit -store m: \ boot \ bcd-set% guid% device Partition = M:
Where % guid% is the GUID of the OS loader.
The useful information on this is very low. I am being embroiled on the BCD WMI provider, and an old MS Word doctor on BCD. I have also found the visual BCD editor for some use in sorting the object and element types, but I actually got stuck on this one. anyone?
OK I have discovered the options are as follows:
for disk objBootMgr.SetPartitionDeviceElement & amp; H11000001, 2, "" \ Device \ Harddisk0 \ Partition3 "
Partition dependent syntax for disk-independent volume syntax, or
objBootMgr.SetPartitionDeviceElement & Amp; h11000001, 2, "" \ Device \ Hard Disk Volume 3 "
.
Comments
Post a Comment