none
Trouble running bcdedit in Powershell

    Pertanyaan

  • Hi

    I'm having trouble running BcdEdit in powershell. I'm running the commands from an administrative shell and PolicyExecution is set to unrestricted.

    The simple line I'm experimenting with is

    "bededit" /enum

    To which I get the reply

    bededit : The term 'bededit' is not recognized as the name of a cmdlet,
    function, script file, or operable program. Check the spelling of the name, or
    if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + bededit /enum
    + ~~~~~~~
        + CategoryInfo          : ObjectNotFound: (bededit:String) [], CommandNotF
       oundException
        + FullyQualifiedErrorId : CommandNotFoundException

    I have tried specifying the full path of bcdedit and i get the message

    At line:1 char:36
    + "c:\windows\system32\bcdedit.exe" /enum
    +                                    ~
    You must provide a value expression on the right-hand side of the '/' operator.
    At line:1 char:36
    + "c:\windows\system32\bcdedit.exe" /enum
    +                                    ~~~~
    Unexpected token 'enum' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordEx
       ception
        + FullyQualifiedErrorId : ExpectedValueExpression

    Can anyone tell me what I'm doing wrong?

    Thanks

    Mr_P

    The 

    • Dipindahkan oleh Bill_Stewart Selasa, 25 Maret 2014 15.13 Abandoned
    Minggu, 10 November 2013 11.24

Semua Balasan

  • Looks like typo

    The term 'bededit' is not recognized as the name of a cmdlet,

    It should be BCDEDIT.

    BCDEDIT /Enum     (No Quotes required)
    
    BCDEDIT /?

    Let me know if that works


    Regards Chen V [MCTS SharePoint 2010]



    • Diedit oleh Chen VMVP Minggu, 10 November 2013 14.44
    • Disarankan sebagai Jawaban oleh jrv Minggu, 10 November 2013 16.10
    Minggu, 10 November 2013 13.22
  • PS C:\> bcdedit /enum

    Windows Boot Manager
    --------------------
    identifier              {bootmgr}
    device                  partition=\Device\HarddiskVolume2
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {globalsettings}
    default                 {current}
    resumeobject            {7dea1eee-3c90-11e1-9929-5c9ad8dbbd16}
    displayorder            {current}
    toolsdisplayorder       {memdiag}
    timeout                 30

    Windows Boot Loader
    -------------------
    identifier              {current}
    device                  partition=C:
    path                    \Windows\system32\winload.exe
    description             Windows 7
    locale                  en-US
    inherit                 {bootloadersettings}
    recoverysequence        {7dea1ef2-3c90-11e1-9929-5c9ad8dbbd16}
    recoveryenabled         Yes
    osdevice                partition=C:
    systemroot              \Windows
    resumeobject            {7dea1eee-3c90-11e1-9929-5c9ad8dbbd16}
    nx                      OptOut

    PS C:\>

    Regards Chen V [MCTS SharePoint 2010]

    Minggu, 10 November 2013 13.24
  • Thanks for the reply.

    How embarrassing a typo!!

    I've rerun, typing correctly this time, and I'm still getting errors. I tried it with and without quotes from an administrative powershell prompt.

    PS C:\Windows\system32> "bcdedit" /enum
    You must provide a value expression on the right-hand side of the '/' operator.
    At line:1 char:12
    + "bcdedit" / <<<< enum
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : ExpectedValueExpression

    PS C:\Windows\system32> bcdedit /Enum
    The term 'bcdedit' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spe
    lling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:8
    + bcdedit <<<<  /Enum
        + CategoryInfo          : ObjectNotFound: (bcdedit:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

    BcdEdit works fine if I just run it from the command prompt

    C:\Windows\system32>bcdedit /enum

    Windows Boot Manager
    --------------------
    identifier              {bootmgr}
    device                  partition=\Device\HarddiskVolume1
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {globalsettings}
    default                 {current}
    resumeobject            {958d556d-402c-11e3-a9f3-a88d231f4692}
    displayorder            {current}
    toolsdisplayorder       {memdiag}
    timeout                 30

    Senin, 11 November 2013 13.04
  • Let me know if you see any output

    $bcdStore=gwmi -name root\wmi -list bcdstore
    $bcdStore

    Just Copy Paste the output you see in the screen

    Regards Chen V [MCTS SharePoint 2010]

    Senin, 11 November 2013 13.11
  • Thanks Chen

    PS C:\Windows\system32> $bcdStore=gwmi -name root\wmi -list bcdstore
    PS C:\Windows\system32> $bcdstore


       NameSpace: ROOT\WMI

    Name                                Methods              Properties
    ----                                -------              ----------
    BcdStore                            {OpenStore, Impor... {FilePath}

    Senin, 11 November 2013 14.22
  • Hi,

    it looks like if bcdedit.exe is not within your PATH for PowerShell, which is very weird.

    What do you get if you run?:

    Get-Command bcdedit
    #and
    c:\windows\system32\bcdedit.exe /enum


    • Diedit oleh Dirk_74 Senin, 11 November 2013 15.16
    Senin, 11 November 2013 15.16
  • BcdEdit is definitely in system32 but these are the results I get.

    PS C:\Windows\system32> get-command bcdedit

    Get-Command : The term 'bcdedit' is not recognized as the name of a cmdlet, function, script file, or operable program.
     Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:12
    + get-command <<<<  bcdedit
        + CategoryInfo          : ObjectNotFound: (bcdedit:String) [Get-Command], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

    PS C:\Windows\system32> c:\windows\system32\bcdedit.exe /enum
    The term 'c:\windows\system32\bcdedit.exe' is not recognized as the name of a cmdlet, function, script file, or operabl
    e program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:32
    + c:\windows\system32\bcdedit.exe <<<<  /enum
        + CategoryInfo          : ObjectNotFound: (c:\windows\system32\bcdedit.exe:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

    Senin, 11 November 2013 15.26
  • BcdEdit is definitely in system32 but these are the results I get.

    The output is telling me something else. What do you get for?:

    dir c:\windows\system32\bcdedit.exe

    You can also try the same from a "clean" session with "powershell -noprofile" from an run dialog.

    • Diedit oleh Dirk_74 Senin, 11 November 2013 15.33
    Senin, 11 November 2013 15.31
  • In powershell I get 

    PS C:\Windows\system32> dir c:\windows\system32\bcdedit.exe
    Get-ChildItem : Cannot find path 'C:\windows\system32\bcdedit.exe' because it does not exist.
    At line:1 char:4
    + dir <<<<  c:\windows\system32\bcdedit.exe
        + CategoryInfo          : ObjectNotFound: (C:\windows\system32\bcdedit.exe:String) [Get-ChildItem], ItemNotFoundEx
       ception
        + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    here's a picture from explorer

    

    but in powershell

    Senin, 11 November 2013 15.47
  • There is something weird going on on your system. Are you running PowerShell as admin? Can you try the dir with the -force switch? Do you get the same in console in ISE?

    • Diedit oleh Dirk_74 Senin, 11 November 2013 16.10
    Senin, 11 November 2013 16.08
  • If its not elevated it should throw Access Denied error

    This is strange !!!


    Regards Chen V [MCTS SharePoint 2010]

    Senin, 11 November 2013 16.09
  • Hi Guys,

    first of all thanks for all your help. I've found the issue.

    I've been running the code on Windows 7 x64 but using the x86 shell. Once I used the Powershell shell it worked fine.

    Thanks

    Senin, 11 November 2013 16.18
  • So the issue is typo and wrong shell for execution. :)

    I am happy that it worked for you!!!

    Cheers!!!


    Regards Chen V [MCTS SharePoint 2010]

    Senin, 11 November 2013 18.22
  • Use this command to enable <g class="gr_ gr_96 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-del replaceWithoutSep" data-gr-id="96" id="96">the </g><g class="gr_ gr_97 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" data-gr-id="97" id="97"><g class="gr_ gr_96 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Grammar only-del replaceWithoutSep" data-gr-id="96" id="96">it</g> :</g> <g class="gr_ gr_18 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="18" id="18">bcdedit</g>/set increaseUserVa 3072

    Then restart the machine to <g class="gr_ gr_102 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="102" id="102">operated</g> the command as BCDEDIT.

    Rabu, 05 September 2018 11.48