Public/New-MBSBootLoader.ps1

function New-MBSBootLoader {
    param (
        [Parameter(Mandatory,HelpMessage="Volume which holds the windows boot manager")]
        $BootVolume
    )
    bcdboot $env:windir /s $BootVolume /f ALL | Out-Null
    if ($?) {Write-Host -ForegroundColor Cyan "Create UEFI and BIOS boot files on $BootVolume"}
    # copy boot.sdi
    Write-Host -ForegroundColor DarkGray "Copied boot.sdi to $BootVolume\boot"
    Copy-Item $env:windir\system32\boot.sdi $BootVolume\boot -Force
    # clear default uefi store
    bcdedit -store $BootVolume\EFI\Microsoft\Boot\BCD -delete '{default}'
    bcdedit -store $BootVolume\EFI\Microsoft\Boot\BCD -create '{ramdiskoptions}' -d "ramdiskoptions"
    bcdedit -store $BootVolume\EFI\Microsoft\Boot\BCD -set '{ramdiskoptions}' ramdisksdidevice partition=$BootVolume
    bcdedit -store $BootVolume\EFI\Microsoft\Boot\BCD -set '{ramdiskoptions}' ramdisksdipath "\boot\boot.sdi"
    bcdedit -store $BootVolume\EFI\Microsoft\Boot\BCD -deletevalue '{ramdiskoptions}' description # fix descript showint in star menu
    Write-Host -ForegroundColor DarkGray "{ramdiskoptions} for uefi bootloader created"

    #clear default bios store
    bcdedit -store $BootVolume\Boot\BCD -delete '{default}'
    bcdedit -store $BootVolume\Boot\BCD -create '{ramdiskoptions}' -d "ramdiskoptions"
    bcdedit -store $BootVolume\Boot\BCD -set '{ramdiskoptions}' ramdisksdidevice partition=$BootVolume
    bcdedit -store $BootVolume\Boot\BCD -set '{ramdiskoptions}' ramdisksdipath "\boot\boot.sdi"
    bcdedit -store $BootVolume\Boot\BCD -deletevalue '{ramdiskoptions}' description # fix descript showint in star menu
    Write-Host -ForegroundColor DarkGray "{ramdiskoptions} for bios bootloader created"
}