dbcc - $db.CheckTables('None') in Powershell doesn't continue on after encountering corrupt database -


probably noob question here goes. i'm making backup test script powershell , i'm displaying results of dbcc in console , when $db.checktables('none') loops through database collection , encounters corrupt database doesn't continue on checking rest of databases. code

foreach($db in $dbs) {        if ($db.name.endswith("_test")) {        write - host "checking database:"        $db.name - backgroundcolor "yellow" - foregroundcolor "black"        $dbname = $db.name# database check        $db.checktables('none')

either supress way:

 $db.checktables('none') -erroraction silentlycontinue 

or wrap in try/catch:

try {   $db.checktables('none') } catch {} 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -