Posts belonging to Category logs



Remove All Files That Are Older Than

The following bat file will delete all files in a directory and its subdirectories that are have a modified date older than 2 years:

@ECHO OFF
REM *** DELETE FILES OLDER THAN 2 YEARS  

REM *** GET TODAYS DATE
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
  	Set Month=%%A
 	Set Day=%%B
 	Set Year=%%C
)  

REM @echo DAY = %Day%
REM @echo Month = %Month%
REM @echo Year = %Year%  

REM *** SUBTRACT 2 FROM THE CURRENT YEAR
set /a Year2=%Year%-2  

forfiles /p "E:\IIS6LOGFILES" /s /m *.log /d -%Month%/%Day%/%Year2% /c "cmd /c del @path"
linkedin Remove All Files That Are Older Thandigg Remove All Files That Are Older Thanshare save 120 16 Remove All Files That Are Older Than

Shrink All Log Files Within A MS SQL Instance

This little SQL script is used to to shrink all the log files in a Microsoft SQL server instance.  It uses the following function to get the job done: DBCC SHRINKFILE.

declare @ssql nvarchar(4000)<br />
set @ssql= '<br />
        if ''?'' not in (''tempdb'',''master'',''model'',''msdb'') begin<br />
			use [?]<br />
			declare @tsql nvarchar(4000) set @tsql = ''''<br />
			declare @iLogFile int<br />
			declare LogFiles cursor for<br />
			select fileid from sysfiles where  status &amp; 0x40 = 0x40<br />
			open LogFiles<br />
			fetch next from LogFiles into @iLogFile<br />
			while @@fetch_status = 0<br />
			begin<br />
				set @tsql = @tsql + ''DBCC SHRINKFILE(''+cast(@iLogFile as varchar(5))+'', 1) ''<br />
				fetch next from LogFiles into @iLogFile<br />
			end<br />
			set @tsql = @tsql + '' BACKUP LOG [?] WITH TRUNCATE_ONLY '' + @tsql<br />
			--print @tsql<br />
			exec(@tsql)<br />
			close LogFiles<br />
			DEALLOCATE LogFiles<br />
        end'<br />
 exec sp_msforeachdb @ssql<br />
 

via CodeSnippets

linkedin Shrink All Log Files Within A MS SQL Instancedigg Shrink All Log Files Within A MS SQL Instanceshare save 120 16 Shrink All Log Files Within A MS SQL Instance

A potentially dangerous Request.Form value

We were having trouble adding a user to a site collection.  Every time we hit the search button or clicked the check userid button the system would just sit there and spin. I added the following section of the web.config to resolve the issue.


The error that we were getting in the trace logs is similar to below.

Exception Type: System.Web.HttpRequestValidationException  Exception Message: A potentially dangerous Request.Form value was detected from the client (ctl00$PlaceHolderDialogBodySection$ctl04$OriginalEntities="").

via Solien Technology

linkedin A potentially dangerous Request.Form valuedigg A potentially dangerous Request.Form valueshare save 120 16 A potentially dangerous Request.Form value

Shrink SQL Transaction Logs

Here is the t-sql statement used to shrink the SQL transaction logs:

Use
Go
Backup Log  With Truncate_Only
DBCC SHRINKFILE(, 1)
Go
linkedin Shrink SQL Transaction Logsdigg Shrink SQL Transaction Logsshare save 120 16 Shrink SQL Transaction Logs