Windows Sandbox cannot be used for testing any software installation which requires a restart. This is one of its shortcomings, I think Microsoft should implement some kind of setting in future to allow a 'persistent' Sandbox besides the current temporary Sandbox. so like user will be asked before launching it that whether they want a Temporary or Persistent sandbox.
Temporary = everything is wiped clean after closing.
Persistent = everything will be there even after host device restart/shutdown or Windows sandbox (guest OS) restart.