Start-PcsvDevice is not up to current spec
I have been using the PcsvDevice commands to use IPMI out-of-band management to my servers. It works great for systems that are configured for legacy boot. But, the reboot does not work properly for systems that are requesting UEFI reboot. Here are the commands that work correctly for legacy booting:
Set-PcsvDeviceBootConfiguration -TargetAddress $ipAddr -Credential $creds -ManagementProtocol IPMI -OneTimeBootSource $device.StructuredBootString
Start-PcsvDevice -TargetAddress $ipAddr -Credential $creds -ManagementProtocol IPMI
The purpose of the above commands is to force a LAN boot no matter what is configured as the first boot device on the targeted server. This is handy if I want to reprovision a server that already has an OS installed. I issue the above commands, a LAN boot is performed, and my PXE server satisfies the request. However, if the targeted server is configured for UEFI boot, the server restarts, but it does not get the first boot item set to the LAN. As a result, the system simply reboots into it installed OS, completely defeating the purpose of what I was trying to do.
In researching this, I found that the IPMI spec was updated a few years ago to handle UEFI. Looking at a network trace, part of the string sent across the wire is this:
0x5 0x80 0x4 0x0 0x0 0x0
However, for UEFI to work, this must be sent on the wire:
0x5 0xA0 0x4 0x0 0x0 0x0
If I use something like ipmitool instead of Start-PcsvDevice to send the proper request across the wire, the UEFI system will LAN boot.
Update the Start-PcsvDevice cmdlet to support UEFI reboot strings.
I also used the Start-PcsvDevice command for my problem (https://social.technet.microsoft.com/Forums/windowsserver/en-US/70a13c40-824f-4595-b70e-d4f5b5c381f7/gracefullysoft-shutdown-of-windows-server-2012-r2?forum=winserverClustering) and I noticed that there are more option with Windows Server 2016 (e.g. -ShutdownType Graceful). But I don't used the command to select the boot device up to now.