I have been regularly using a Powershell script I wrote some time ago that sets up database mirroring and it works fine but I am interested to try out the Invoke-DbaDbMirroring cmdlet. However, the problem is that it prompts for the password for the mirroring Logins even though I haven’t specified the PrimarySqlCredential or MirrorSqlCredential params.
This is on a pair of servers on which mirroring has already been setup and the Endpoints have been created, etc. In my existing powershell script that does not use Invoke-DbaDbMirroring, all it does to start database mirroring after the usual db and log backup and restores is to issue the ALTER DATABASE [myDB] SET PARTNER = ‘TCP:…’ command and it works. Same if I do it all manually via T-SQL. I never have to be concerned with the passwords for the SQL Login on Primary or Mirror.
$PrimaryServer = “SQL01”
$MirrorServer = “SQL02”
$dbName = “MyDB”
Invoke-DbaDbMirroring -Primary $PrimaryServer -Mirror $MirrorServer -Database $dbName -SharedPath “\$MirrorServer\BackupsForMirroring” -Confirm:$false
Any ideas what the issue is? I don’t believe I should be prompted for the passwords.
thanks in advance.