When a system is working on Windows Updates that require a reboot, at a certain stage it will kick RDP sessions and new RDP sessions will immediately be bounced back. But, I've also seen other (mystery) cases where new RDP sessions are kicked immediately in the same fashion.
What I'm hoping to find is a way to tell via PowerShell (via SSH, remoting, virsh/IPMI console, or ansible) that a host is in this sort of "you can't RDP because we're applying Windows Updates in preparation for a reboot" state.
I've looked at various Windows Update related status objects in PowerShell but I've been unable to find one that can confirm "yes the machine is in this state so your RDP not working is expected".
Bonus points if there's also some way to confirm that progress is truly being made on the work (and that it's not stuck and needing a forced reboot).