Problem with Script to Synchronize Login on AlwaysON
I would suggest using dbatools - Sync-DbaAvailabilityGroup with -Exclude &lt;-- exclude the settings that you dont need to sync. 

Honestly, you should sync all e.g. sp_configure, logins, jobs, etc