- Code: Select all
$escapeddbhost = $dbhost -replace "\\", "_"
$logfile = [System.IO.Path]::Combine($logdir, $escapeddbhost + "-" + $now.ToString("yyyy-MM-dd") + ".log")
Once that was fixed it threw this:
- Code: Select all
Backup failed for Server 'DEEVUS-PC\SQLEXPRESS'.
At C:\backup\automssqlbackup.ps1:230 char:15
+ $bk.SqlBackup <<<< ($srv)
+ CategoryInfo : NotSpecified: (:) [], FailedOperationException
+ FullyQualifiedErrorId : DotNetMethodException
I haven't had any experience debugging powershell before so maybe you could help me in that regard. Could it be that I don't have the "SMO libraries" that you list as a prerequisite? Seems unlikely as it should have thrown an exception a few lines higher where it creates the SMO library object.