Hi @Morales, Emma L STF (CTR) ,
I'm not familiar with PowerShell script, but per my knowledge you could use some third party tools to detect broken links. You could get more detials from the following discussion.
For Reference: Detect broken links in documents - Sharepoint online migration
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.