0

I'm trying to resolve an issue. I've a two nodes with Always On enabled, I want to synchronize user over the nodes. I see that fantastic script.

https://maq.guru/synchronizing-sql-server-logins-in-an-always-on-availability-group/

Only one problem, when an user SQL have Policy enabled tghi script can't change password on other node.

Error message:

Invoke-Sqlcmd : A HASHED password cannot be set for a login that has CHECK_POLICY turned on.
A HASHED password cannot be set for a login that has CHECK_POLICY turned on.
At C:\Users\Administrator\Desktop\AutoCloneLogins.Or.ps1:343 char:17
+ ... Invoke-Sqlcmd -Query $Query -ServerInstance $SecondaryRep ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
+ FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand**

Please help me to resolve this issue.

1
2

I would suggest using dbatools - Sync-DbaAvailabilityGroup with -Exclude <-- exclude the settings that you dont need to sync.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.