Any PowerShell Script to Backup and restore Ms-sql database using dB username and password?

I am looking for a PowerShell script which can take backup and restore MS-SQL databases using SQL authentication.


You can use Backup-DbaDatabase cmdlet from dbatools, you just need to install the module first and then set the -SqlCredential parameter with the username and password. Lots of examples out there.