I have wrote a script that will run and populate a env var with the databases that are in simple mode :
@echo off
sqlcmd -S server\instance -Q "set nocount on; select name from sys.databases where recovery_model!=1" -W -h -1 -o c:\U...\...\Desktop\sql.txt
setlocal EnableDelayedExpansion
set "txt="
set input=c:\....\......\Desktop\sql.txt
for /f "delims=" %%a in (%input%) do (
set "txt=!txt!%%a,"
)
set "txt=!txt:~0,-1!"
>new.txt echo !txt!
echo %txt%
setx NB_SQL_DATABASE_EXCLUDE %txt%
echo %NB_SQL_DATABASE_EXCLUDE%
and i have the following script for a tranlog backup:
BATCHSIZE 3
OPERATION BACKUP
DATABASE $ALL
SQLHOST "sqlhost"
SQLINSTANCE "SQL2008R2"
NBSERVER "master01"
MAXTRANSFERSIZE 6
BLOCKSIZE 7
OBJECTTYPE TRXLOG
NUMBUFS 2
ENDOPER TRUE
But when the policy runs i still see it running the excluded databases by the enviornment variable.
any thoughts?