Ignore a database in an Availability group when using @AvailabilityGroups = instead of @Databases with ola-hallengren backup solution
You can't use both the @Databases and @AvailabilityGroups parameter. If you try, you'll get this error:


  Msg 50000, Level 16, State 1, Procedure DatabaseBackup, Line 633
  [Batch Start Line 0] You can only specify one of the parameters
  @Databases and @AvailabilityGroups.


For your condition, you'd want to only use @Databases with something like

@Databases = 'DB1, DB2'
@Databases = 'AVAILABILITY_GROUP_DATABASES, -DB1'