I use Connect-PnpOnline with -interactive because my account uses MFA. I can connect and run my scripts against my site. I have a script that runs very long. During the execution of the script the token becomes invalid and I have to disconnect and connect again to run my script again. I now run batches and after each batch I disconnect and run Connect-PnpOnline again. But this means I have take action after every batch.
Is there a way I can refresh the token during execution?