all you have to do is change the version check from
IF @OSVersion = '5.2'
to IF @OSVersion >= '5.2'
umm yeah thats easy.
also I know this is an old thread but I am using this due to an issue I am having using the maint cleanup task not working. this is kinda slow if you call it repetavily and with many file.. I use a cursor to call it and it takes abt 20 min. Not really in a hurry though
DECLARE @databasename as varchar(200)
declare @strSQL as nvarchar (4000)
DECLARE Curse CURSOR local fast_forward
name not in ('tempdb','AdventureWorks','AdventureWorksDW')
order by name desc
FETCH next FROM Curse INTO @databasename
WHILE @@fetch_status = 0
set @strSQL = 'EXEC DBA.dbo.usp_Admin_Delete_Files_By_Date @SourceDir = ''\\resnetapp01\prodsqlbackups$\NIGHTLY\RESMSSQL2008\' + @databasename + '\'', @SourceFile = ''*'', @DaysToKeep = 5'
EXEC dbo.sp_executesql @strSQL
fetch next from Curse into @databasename
MCT, MCITP(SQL DBA 2005/2008),MCTS, MCP,MCDBA