Is there a way to call Backup-SqlDatabase cmdlet but have it connect to SQL Server 2012 with SQL Server credentials?
The command I am currently using is:
Backup-SqlDatabase -ServerInstance $serverName -Database $sqldbname -BackupFile "$($backupFolder)$($dbname)_db_$($addinionToName).bak"
But this relies on the user, under which it is being call, and by default, Windows Authentication is being used.
The backup-sqldatabase cmdlet supports the Credential parameter. If you look at the help for the cmdlet there's even an example (from help backup-sqldatabase -full):
-------------------------- EXAMPLE 4 --------------------------
C:\PS>Backup-SqlDatabase -ServerInstance Computer\Instance -Database MyDB -Credential (Get-Credential sa)
Description
-----------
This command creates a complete database backup of the database 'MyDB', using the sa SQL Server credential. This co
mmand will prompt you for a password to complete SQL Server authentication.