1

I try to use the powershell command Backup-SqlDatabase with a specific windows authentication (not the current)

Backup-SqlDatabase -ServerInstance $instanceName -Database $databaseName -BackupAction Database -Credential $credential -BackupFile $backupFilePath

With -Credential, it only supports SQL authentication

Without it uses the current windows user authentication

Batbaille
  • 61
  • 1
  • 5
  • I tried to use a new Powershell session (New-PSSession) with the specific windows authentification but in this case I lose the context of my powershell library "SqlServer": ObjectNotFound: The 'Backup-SqlDatabase' command was found in the 'SQLPS' module, but the module could not be loaded. For more information, run 'Import-Module SQLPS'. – Batbaille Apr 04 '22 at 16:31
  • I would take a look at DBAtools for powershell, extremely useful when working with SQL server. They have a backup function that should work with active directory login: https://docs.dbatools.io/Backup-DbaDatabase – Owain Esau Apr 04 '22 at 23:26

0 Answers0