Thank you for reaching out to Microsoft Q&A forum
The root cause of this behavior is even though the script is executed using a farm administrator account in SharePoint 2019, it encounters “Access Denied” or “Object Not Found” errors on some site collections.
Given this, I highly recommend you can try to run that cmdlet again right after applying these approaches below:
Grant Full Control via Web Application Policy via using Central Administration to assign a Full Control policy to the script account for the target web application. This ensures consistent access across all site collections via Central Admin → Security → Configure Web Application User Policy
Add the Account as Site Collection Administrator (SCA): If only a few site collections are affected, manually add the account as an SCA to those sites.
Check for Locked or Inaccessible Sites Ensure no site collections are in a locked stateusing the Get-SPSite and Set-SPSite -LockState cmdlets.
You can try the above approach, if the problem still persists, kindly let me know in the comments for further support.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.