Here’s a quick script that will backup all databases to a shared location on the network. The database backup files will be titled like this: MyDatabaseName.bak There is some extra logic to replace apostrophe’s in the database name in case you have any. I don’t know why you would have them, but I just found a box that does, so I included that in there. Additionally; this will not backup the system databases. Only user databases are backed up.
use master; set nocount on declare @backup_all_databases varchar(max) set @backup_all_databases = '' select @backup_all_databases = @backup_all_databases + 'backup database [' + name + '] to disk = ''\\MyShareName\' + replace(name, '', '''') + '.bak'' with format;' + char(10) from sys.databases where name not in ('tempdb') order by name asc exec (@backup_all_databases)