Pradeep Yadav

Pradeep Yadav

  • 375
  • 5.3k
  • 1.2m

Database Back Up using Powershell

Mar 2 2020 8:15 AM
Hi Team,
I am trtying to take back up using poweshell 
Below is the command which we are trying to execute,
Backup-SqlDatabase -ServerInstance "SERVER\DEFAULT" -Database "AFC" -BackupFile "\\REMOTESERVER\temp123\$dbName.bak" 
However when we are trying to execute the same we are getting below error
Backup-SqlDatabase : Failed to connect to server\DEFAULT.
At line:1 char:1
+ Backup-SqlDatabase -ServerInstance "\DEFAULT" -Database "A ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Backup-SqlDatabase], ConnectionFailureException
+ FullyQualifiedErrorId : Microsoft.SqlServer.Management.Common.ConnectionFailureException,Microsoft.SqlServer.Man
However when we are trying to execute Get-ChildItem command we are gettting names of all databases.
Please help us.

Brought to you by:

Answers (2)