K
K
KJIayD2016-08-05 12:48:42
PowerShell
KJIayD, 2016-08-05 12:48:42

Backup MS SQL 2014 Express and PowerShell?

Good day.
I transfer the n-th number of databases to the MS SQl server and the question touched on backup. The PowerShell method was chosen with the following script:
PS C:\> dir SQLSERVER:\sql\1cserver\sqlexpress\databases | Backup-SqlDatabase
That is, we create a back-up of each database in the default directory. The question is:
How do I choose my catalog? The question is simple, but I did not find this information anywhere. BackupFile, as I understand it, is not suitable

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KJIayD, 2016-08-05
@KJIayD

Thanks to all. The question is closed.
Set-Location "SQLSERVER:\sql\1cserver\sqlexpress\databases"
foreach($database in (Get-ChildItem)) {
$dbName = $database.Name
Backup-SqlDatabase -Database $dbName -BackupFile "c:\db\$ dbName.bak"
}
Study link:
https://technet.microsoft.com/en-us/library/mt6833...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question