Run below query on DB server
DECLARE @SQL VARCHAR(MAX) = ''
SELECT @SQL = @SQL + 'DECLARE @TA_LOGFILE_NAME VARCHAR(500)'
SELECT @SQL = @SQL + 'DECLARE @TA_DATABASE_NAME VARCHAR(500)'
SELECT
@SQL = @SQL + 'USE [' + d.name + N']' + CHAR(13) + CHAR(10)
+ 'EXEC (''ALTER DATABASE ['+d.name+'] SET RECOVERY SIMPLE'');'
+ CHAR(13) + CHAR(10)
+ 'SELECT @TA_LOGFILE_NAME=NAME FROM SYS.DATABASE_FILES
WHERE DATA_SPACE_ID=0' + CHAR(13) + CHAR(10)
+ 'SELECT @TA_DATABASE_NAME = DB_NAME()' + CHAR(13) + CHAR(10)
+ 'DBCC SHRINKFILE (@TA_LOGFILE_NAME, 1);' + CHAR(13) + CHAR(10)
+ 'EXEC (''ALTER DATABASE ['+d.name+'] SET RECOVERY FULL'');'
+ CHAR(13) + CHAR(10)
+ '--PRINT @TA_DATABASE_NAME + ''LOG SHRINKED'''
+ CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10)
FROM
sys.databases d
WHERE d.database_id > 4;
EXEC(@SQL)