Problem with executing Invoke-SqlRestore

Oct 17, 2012 at 10:00 PM


trying to create automated script to import backups automatically based on this snippet

but I got the error somewere in SQLServer module of SQLPSX

Environment: Windows Server 2008 R2 Standard, MS SQL 2012 Standard, 

PS D:\backups> get-executionpolicy

PS D:\backups> Invoke-SqlRestore -sqlserver SqlSrv  -filepath D:\Backups\Copy -fileListOnlyException calling "ReadFileList" with "1" argument(s): "An exception occurred while executing a Transact-SQL statement or batch."At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\sqlserver\SQLServer.psm1:2768 char:30+         $restore.ReadFileList <<<< ($server)    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE   xception    + FullyQualifiedErrorId : DotNetMethodException
PS D:\backups>


Any ideas?

Oct 18, 2012 at 1:29 AM

okay got this fixed, I was passing folder, not file, that's why it didn't work