Jump to content











Photo
- - - - -

BCDedit, enum, Identifiers and Current?

bcdedit

Best Answer David English , 19 October 2018 - 04:27 PM

 The current identifier is given by

bcdedit /enum {current} /v

The default identifier is given by

bcdedit /enum {default} /v

Often the current and default identifier are equal, unless you boot with a non-default entry.

 

Yes... I was missing something simple.  Very glad I asked, and a big thank you for answering.  This is exactly what I need.

 

David...

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 David English

David English
  • Members
  • 6 posts
  •  
    Canada

Posted 18 October 2018 - 05:59 PM

... actually, I just figured it out.  Nice thing about writing out a problem.  Thank you.  However, there's probably a better way, so I'll keep posting this.

 

  David...

 

 

So, everything is going great.  I've got systems that can PXEboot to Linux (liveCD environments) or drop down to the local Windows boot manager with multiple VHDX boot options that I can add to on the fly.  We've even got Linux as a local boot option as well, again just copied to the drive as a file (or a few files at any rate).  I have PowerShell scripts that let me copy over and add VHDX images to multiple target machines, customizing the unattend files in the process... 100s of machines at a go. Works great, the instructors love it.

 

So, now I'm trying to clean up the mess.  Via PowerShell, I can now take the output of BCDedit and dump it in a hash of hashes, basically a hash for each identifier.  But, I've run into a stupid problem and I can't find the way out.

 

BCDedit /enum /v gives me a list of entries, each having an {...} identifier.  BCDedit by itself gives me a list of entries where the well known identifiers are replaced by {current} etc.  That's nice.  But, I can't figure out which of the {...} identifiers IS the {current} boot.  It seems trivial, BCDedit obviously knows the answer, but I can't get it to tell me.

 

I could just link them together by comparing the 'device' fields... but that will fall apart if I end up having 2 boot entries that point to the same device.  Yeah, this has already happened.  Things get a little messy when developing a new imaging system a week before classes start.  Anyway, I can manually fix machines that get mucked like this, but I'd rather have code robust enough to handle it.

 

I've now realized that I can collect the identifiers from bcdedit /enum /v and subtract the not "well known" identifiers I get from bcdedit itself... the ones left will be current and default, and default is easy.

 

So, I can do it.  But, is there an easier way?  I feel like I'm missing something simple.



#2 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 19 October 2018 - 06:44 AM

 The current identifier is given by

bcdedit /enum {current} /v

The default identifier is given by

bcdedit /enum {default} /v

Often the current and default identifier are equal, unless you boot with a non-default entry.


  • David English likes this

#3 David English

David English
  • Members
  • 6 posts
  •  
    Canada

Posted 19 October 2018 - 04:27 PM   Best Answer

 The current identifier is given by

bcdedit /enum {current} /v

The default identifier is given by

bcdedit /enum {default} /v

Often the current and default identifier are equal, unless you boot with a non-default entry.

 

Yes... I was missing something simple.  Very glad I asked, and a big thank you for answering.  This is exactly what I need.

 

David...


  • wimb likes this



Also tagged with one or more of these keywords: bcdedit

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users