Closes #25358 Based on dr-j's script (cherry picked from commit 2ff8da2acd5f336e92c07a3e1165c35e20400027)