Monday, March 18, 2013

Purging any windows logs with Task Sheduler in Win 2003 & Win 2008

http://social.technet.microsoft.com/Forums/en-US/configmgrgeneral/thread/d989b249-0159-41fc-b78c-1f1d91ce8bb3/


The mistake I found in Tom Watson's script is the added backslash \ before the Cmd.exe string resulting in the following:
ERROR: Invalid syntax. '/C' option is not allowed more than '1' time(s).
Type "FORFILES /?" for usage.
The fix, at least in my case was to remove the backslash \ as shown below.
Windows 2003
at 12:00 /EVERY:Su Forfiles.exe -p C:\WINDOWS\system32\LogFiles\W3SVC1 -m *.log -d -30 -c "Cmd.exe /C del @path\"

Windows 2008
at 12:00 /EVERY:Su Forfiles.exe -p C:\inetpub\logs\LogFiles\W3SVC1 -m *.log -d -30 -c "Cmd.exe /C del @path\"

No comments:

Post a Comment