Hi everyone.I have a script that works great at the moment. The Script I use checks all SQL servers in a table for the last backup status. It then emails out an exception report for databases missing a full backup etc.As I mentioned script works fine for all databases on the instances being checked.The enhancement I want to do is to amend the script to ignore certain databases that exist in say an exception table.This is the code segment that I think I need to amend.[code="other"]# COMMENT: This script checks every server in the inventory, and gets the databases # that have not been backed up for some time defined by minutes. # An exception report is created and sent to the DBA group.# Loop through the list OF SQL Server instances AND run the CHECK-Backups FUNCTION# against each instance TO get the BACKUP exceptions.Foreach ($sqlServer IN $sqlServers) { $sqlNetworkName=$sqlServer.SQLNetworkName $sqlInstanceName=$sqlServer.instanceName $tcpPort=$sqlServer.tcpPort $strResult="" IF ($sqlInstanceName -ieq 'MSSQLSERVER') { $strResult=(CHECK-Backups "$sqlNetworkName,$tcpPort"$backupType $minutes) IF ($strResult -ne "" { $exceptions=$exceptions + $strResult + "`n" } } ELSE { $strResult=(CHECK-Backups "$sqlNetworkName\$sqlInstanceName,$tcpPort"$backupType $minutes) IF ($strResult -ne "" { $exceptions=$exceptions + $strResult + "`n" } }}[/code]I am guessing I need some kind of table created that holds the databases to be excluded. The Script will then run against all the database in inventory , but then exclude those databases it finds in the exception table.Just not sure on how to code that ??Any help or advice appreciated,
↧