<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Random thoughts of an overloaded mind &#187; server</title>
	<atom:link href="http://blog.amarkulo.com/tag/server/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.amarkulo.com</link>
	<description>Yet another technical blog about iOS, Windows, Linux, Arduino and everything else</description>
	<lastBuildDate>Tue, 13 Dec 2011 16:56:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Migrating Acronis backup server to another machine</title>
		<link>http://blog.amarkulo.com/migrating-acronis-backup-server-to-another-machine</link>
		<comments>http://blog.amarkulo.com/migrating-acronis-backup-server-to-another-machine#comments</comments>
		<pubDate>Thu, 10 Feb 2011 15:38:54 +0000</pubDate>
		<dc:creator>amar</dc:creator>
				<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[acronis]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[machine]]></category>
		<category><![CDATA[migrate]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[move]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.amarkulo.com/?p=437</guid>
		<description><![CDATA[Today I have migrated Acronis backup server (0lder version) to another machine. Procedure is simple: install backup server on another machine configure backup location stop the service copy all files from old server to new server in configured backup location &#8230; <a href="http://blog.amarkulo.com/migrating-acronis-backup-server-to-another-machine">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I have migrated Acronis backup server (0lder version) to another machine.</p>
<p>Procedure is simple:</p>
<ul>
<li>install backup server on another machine</li>
<li>configure backup location</li>
<li>stop the service</li>
<li>copy all files from old server to new server in configured backup location</li>
<li>copy C:\Document and Settings\All Users\Application Data\Acronis\Backup server dir to another server overwriting the another one</li>
<li>start the service</li>
<li>check if everything is ok with Management Console</li>
</ul>
<hr>
<p><div class="entry-utility">If you don't already have a <a href="http://db.tt/aqrG0tY">Dropbox</a> account then you can create it by clicking on my <a href="http://db.tt/aqrG0tY">affiliate link</a>. You will receive 2GB free account + 250 MB extra and I will receive 250 MB as well. Win-Win :-)</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amarkulo.com/migrating-acronis-backup-server-to-another-machine/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find and decrypt cisco group password on Mac</title>
		<link>http://blog.amarkulo.com/find-and-decrypt-cisco-group-password-on-mac</link>
		<comments>http://blog.amarkulo.com/find-and-decrypt-cisco-group-password-on-mac#comments</comments>
		<pubDate>Sun, 03 Oct 2010 11:54:57 +0000</pubDate>
		<dc:creator>amar</dc:creator>
				<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[decrypted]]></category>
		<category><![CDATA[encrypted]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[Mac tips]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[pcf]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://blog.amarkulo.com/?p=379</guid>
		<description><![CDATA[So today I wanted to move one Cisco VPN connection from my MBP to another mac. The problem was that I didn&#8217;t received any .pcf file from admin, I got only group login and password (which I didn&#8217;t wrote down). &#8230; <a href="http://blog.amarkulo.com/find-and-decrypt-cisco-group-password-on-mac">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So today I wanted to move one Cisco VPN connection from my MBP to another mac.</p>
<p>The problem was that I didn&#8217;t received any .pcf file from admin, I got only group login and password (which I didn&#8217;t wrote down).</p>
<p>So after bit of searching on the disk I have found that Cisco VPN client is creating new <strong>.pcf</strong> file for every connection that you create in it. They are located in <strong>/private/etc/opt/cisco-vpnclient/Profiles </strong>directory and waiting to be exctracted. So to be able to obtain password from it do like this:</p>
<ol>
<li>open file from that directory, file will have same name as Connection name in Cisco VPN Client</li>
<li>in the file find string <strong>enc_GroupPwd=</strong> and copy everything behind <strong>=</strong> sign</li>
<li>open <a title="cisco vpnclient password decoder" href="http://www.unix-ag.uni-kl.de/~massar/bin/cisco-decode">this site</a> and copy encrypted password there, click decode button and site will return decrypted group password</li>
<li>now you have password and you can create new connection on the another mac with details that you have on old one, host ip, group name, password, etc.</li>
</ol>
<hr>
<p><div class="entry-utility">If you don't already have a <a href="http://db.tt/aqrG0tY">Dropbox</a> account then you can create it by clicking on my <a href="http://db.tt/aqrG0tY">affiliate link</a>. You will receive 2GB free account + 250 MB extra and I will receive 250 MB as well. Win-Win :-)</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amarkulo.com/find-and-decrypt-cisco-group-password-on-mac/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Snort Intrusion Detection System on Windows</title>
		<link>http://blog.amarkulo.com/how-to-install-snort-ids-on-windows</link>
		<comments>http://blog.amarkulo.com/how-to-install-snort-ids-on-windows#comments</comments>
		<pubDate>Tue, 22 Dec 2009 15:05:20 +0000</pubDate>
		<dc:creator>amar</dc:creator>
				<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[freeware]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[packet]]></category>
		<category><![CDATA[pcap]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sniff]]></category>
		<category><![CDATA[sniffer]]></category>
		<category><![CDATA[snort]]></category>
		<category><![CDATA[win]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[winpcap]]></category>

		<guid isPermaLink="false">http://blog.amarkulo.com/?p=267</guid>
		<description><![CDATA[First short explanation what is Snort from Snort official website: Snort® is an open source network intrusion prevention and detection system (IDS/IPS) developed by Sourcefire. Combining the benefits of signature, protocol and anomaly-based inspection, Snort is the most widely deployed &#8230; <a href="http://blog.amarkulo.com/how-to-install-snort-ids-on-windows">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>First short explanation what is Snort from Snort official website:</p>
<blockquote><p><em>Snort® is an open source network intrusion prevention and detection system (IDS/IPS) developed by Sourcefire. Combining the benefits of signature, protocol and anomaly-based inspection, Snort is the most widely deployed IDS/IPS technology worldwide.</em></p></blockquote>
<p>Installation of Snort on Windows is pretty simple.</p>
<p>First, you need to download and install few things. For Snort to be able to act as sniffer and IDS it needs Windows Packet Capture Library which is WinPcap. The stable latest version on the site is 4.1.1 and you can download it <a title="WinPcap download" href="http://www.winpcap.org/install/default.htm">here</a>.</p>
<p>Now when we have WinPcap installed the next step will be to download Snort. The latest version for Windows is 2.8.5.1 and you can download it <a title="Snort downloads" href="http://www.snort.org/snort-downloads?">here</a>. Installation shouldn&#8217;t be a problem, if you need IPv6 support and logging to Microsoft SQL or Oracle database then you need to select proper radio and check boxes and if don&#8217;t then just go next and next to the end and that&#8217;s it. Default installation directory is <strong>C:\Snort </strong>so remember it because it will be our working dir all the time.</p>
<p>So we have installed WinPcap and Snort but we are not finished with installation yet. We have one more thing to download and install. The Snort rules. These rules are those small files that tells Snort what it should search for in captured packages and how to identify them, as a threat, information disclosure or something else. For us to be able to download Snort rules we have to be registered on Snort site. Registration is free and rules are one month old for free users, for those who need the latest threats detected at the same moment when they are published to the community I suggest to buy VRT subscription so you will have the latest rules directly as they are announced. So now we will download <strong>snortrules-snapshot-2.8.tar.gz</strong> rules archive file.  When you open archive file you will get following structure:</p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_271" class="wp-caption aligncenter" style="width: 148px;">
<dt class="wp-caption-dt"><a href="http://blog.amarkulo.com/new/wp-content/uploads/2009/12/rules.jpg"><img class="size-full wp-image-271" title="Structure of rules " src="http://blog.amarkulo.com/new/wp-content/uploads/2009/12/rules.jpg" alt="" width="138" height="84" /></a></dt>
</dl>
</div>
<p style="text-align: left;">Snort rules</p>
<p style="text-align: left;">Copy all four directories over those in C:\Snort replacing contents that already exists on the hard drive.</p>
<p style="text-align: left;">Now when we are done with easy part we need to configure Snort to run. Because these rules are written for unixoid systems we need to change some things in the main config file C:\Snort\etc\snort.conf so that Snort can start at all.</p>
<p style="text-align: left;">Here are the things that you need to edit to be able to run snort:</p>
<p style="text-align: left;">Find lines 269 and 270. These lines will not allow Snort to start, at least not on Windows because Snort detects the second one as double config detection line so we need to change this.</p>
<p style="text-align: left;">Change from this:</p>
<blockquote>
<p style="text-align: left;">config detection: search-method ac-bnfa<br />
config detection: max_queue_events 5</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">config detection: search-method ac-bnfa max_queue_events 5</p>
</blockquote>
<p style="text-align: left;">Now, the next thing that we need to change is lines where we say to Snort where to find dynamic preprocessor files. On lines from 298 to 303 change this:</p>
<blockquote>
<p style="text-align: left;">dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_dce2_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_dns_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ftptelnet_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ssh_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ssl_preproc.so</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dce2.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dcerpc.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dns.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ftptelnet.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_smtp.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ssh.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ssl.dll</p>
</blockquote>
<p style="text-align: left;">Next thing to change is line 324 on which we have dynamic engine path, so change it from this:</p>
<blockquote>
<p style="text-align: left;">dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">dynamicengine C:\Snort\lib\snort_dynamicengine\sf_engine.dll</p>
</blockquote>
<p style="text-align: left;">I don&#8217;t know why, maybe some mistake, but lines bellow should be commented out by default, but they were not so we have to comment them out. Because we are not VRT subscriber and don&#8217;t have any dynamic detection files we need to coment lines from 339 to 354, so change this:</p>
<blockquote>
<p style="text-align: left;">dynamicdetection file /usr/local/lib/snort_dynamicrules/bad-traffic.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/chat.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/dos.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/exploit.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/imap.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/misc.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/multimedia.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/netbios.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/nntp.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/p2p.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/smtp.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/sql.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/web-client.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/web-misc.so</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">#dynamicdetection file /usr/local/lib/snort_dynamicrules/bad-traffic.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/chat.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/dos.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/exploit.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/imap.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/misc.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/multimedia.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/netbios.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/nntp.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/p2p.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/smtp.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/sql.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/web-client.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/web-misc.so</p>
</blockquote>
<p style="text-align: left;">Now we need to trim a bit SSH preprocessor to work on Windows as it is different from Linux one, so find line 753 and change this:</p>
<blockquote>
<p style="text-align: left;">preprocessor ssh: server_ports { 22 } \<br />
max_client_bytes 19600 \<br />
max_encrypted_packets 20 \<br />
disable_srvoverflow \<br />
disable_protomismatch \<br />
disable_badmsgdir</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">preprocessor ssh: server_ports { 22 } \<br />
max_client_bytes 19600 \<br />
max_encrypted_packets 20</p>
</blockquote>
<p style="text-align: left;">Now we are good to go. We can test snort easily from the command line. So now go on <strong>Start-&gt;Run </strong>and type <strong>cmd</strong> following by enter key. Now in command prompt type following commands:</p>
<blockquote>
<p style="text-align: left;">c: and then enter key</p>
<p style="text-align: left;">cd c:\snort\bin and then enter key</p>
<p style="text-align: left;">snort -v -c C:\snort\etc\snort.conf -l C:\snort\log -K ascii and then enter key</p>
</blockquote>
<p style="text-align: left;">So now we have entered Snort directory and started Snort on command line. You will first see Snort starting and parsing config file snort.conf and then you will see lot of output when Snort start sniffing and controlling packages on the network. If it finds any package that is not regular network traffic it will save info about it in c:\Snort\Log\alert.ids file. Simple output of one captured packet looks like this:</p>
<blockquote>
<p style="text-align: left;">[**] [1:254:7] DNS SPOOF query response with TTL of 1 min. and no authority [**]<br />
[Classification: Potentially Bad Traffic] [Priority: 2]<br />
12/22-12:19:12.577553 192.168.137.206:53 -&gt; 192.168.137.10:55153<br />
UDP TTL:128 TOS:0&#215;0 ID:5399 IpLen:20 DgmLen:79<br />
Len: 51</p>
</blockquote>
<p style="text-align: left;">Now to explain what we have here. The first line says what type of attack is it, the second line says what classification is it and what priority does it have, and the last three lines are data about the attack, attacker IP, your IP, destination and source ports and so on.</p>
<div style="text-align: left;">Important part of this log is<strong> [Priority: 2]</strong> because that&#8217;s how you can identify the real threat from false one. The threats are divided in three groups, group 3 or <strong>[Priority: 3] </strong>is the lowest one and it usually means that someone is scanning your network. The second one is a bit serious. It&#8217;s information disclosure and it has <strong>[Priority: 2]</strong>. This means that someone has got some info about services that you are running which is usually the first part of any attack, gaining of information. The most critical one is the one with <strong>[Priority: 1] </strong>which usually means that right now someone is trying to exploit some of services that you are running. This could mean that you have older version of some service on your server, like IIS that is not updated or Exchange server or something else and that snort has detected some patterns in packages sent to server that could be exploits which can do harm.</div>
<div style="text-align: left;">Now we can stop Snort with <strong>Ctrl+C</strong> and Snort will display some statistics. The only thing that we have to do now is to install Snort as a Windows service. To do so we will write following command on command prompt:</div>
<blockquote>
<div style="text-align: left;">snort /service /install -c C:\Snort\etc\snort.conf -l C:\Snort\log -K ascii</div>
</blockquote>
<div style="text-align: left;">After this command service is installed and you can start it from service manager or simply type <strong>sc start snortsvc.</strong></div>
<div style="text-align: left;">So with this Snort is installed on your machine and is logging everything. Now you just need some program to parse alerts and do actions based on the alert priority. There are lot of those available on the Internet.</div>
<div style="text-align: left;"></div>
<div style="text-align: left;"><strong>Note 1:</strong> If you have more than one network interface on your machine you need to tell Snort on which one should it listen. First type snort -W command to list all interfaces on your machine (works only on Windows) and then when you find which interface is the one that you will listen on then you need to add <strong>-i n</strong> where n is number of interface from the list that you got. You need to add that to all Snort commands that you are executing from command prompt and when creating Windows service.</div>
<div style="text-align: left;"><strong>Note 2:</strong> If you want Snort to log alerts to Eventlog as well as to log files than add -E (only on Windows) to the command line parameters.</div>
<div style="text-align: left;"><strong>Update</strong>:  Here is my <a class="downloadlink" href="http://blog.amarkulo.com/wp-content/plugins/download-monitor/download.php?id=4" title=" downloaded 518 times" >snort.conf (518)</a> file which is working on my machine without any problems. It could be something with updated rules that can cause problems with starting of Snort.</div>
<div style="text-align: left;"><strong>Update2</strong>:  One trailing / on ssh preprocesor line was left by mistake, now it&#8217;s removed.</div>
<hr>
<p><div class="entry-utility">If you don't already have a <a href="http://db.tt/aqrG0tY">Dropbox</a> account then you can create it by clicking on my <a href="http://db.tt/aqrG0tY">affiliate link</a>. You will receive 2GB free account + 250 MB extra and I will receive 250 MB as well. Win-Win :-)</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amarkulo.com/how-to-install-snort-ids-on-windows/feed</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>Synchronize directories from command prompt</title>
		<link>http://blog.amarkulo.com/synchronize-directories</link>
		<comments>http://blog.amarkulo.com/synchronize-directories#comments</comments>
		<pubDate>Wed, 27 May 2009 05:55:13 +0000</pubDate>
		<dc:creator>amar</dc:creator>
				<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[dominik jain]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[mirror.exe]]></category>
		<category><![CDATA[oblivion]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[win]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.amarkulo.com/?p=202</guid>
		<description><![CDATA[If you have ever wanted to synchronize 2 directories from command prompt in windows this tool is must-have for you. It works perfectly from scheduled tasks as well, so it&#8217;s easy to write batch script that will execute every night &#8230; <a href="http://blog.amarkulo.com/synchronize-directories">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you have ever wanted to synchronize 2 directories from command prompt in windows this tool is must-have for you.<br />
It works perfectly from scheduled tasks as well, so it&#8217;s easy to write batch script that will execute every night and synchronize files and folders.</p>
<p>The program is called Mirror and is written by Dominik Jain and you can download it <a title="Dominik Jain" href="http://home.in.tum.de/~jain/index.html" target="_blank">here</a>. The latest version is 1.43.</p>
<p>It works very simple like it should, you enter source and destinations dir and that&#8217;s it. If you want only to test it w/o any actions taken just add -d (d for demonstration).</p>
<p>Of course it has possibility to enter file mask or regular expressions as well and it&#8217;s only 172kb in size.</p>
<p>On his <a title="Dominik Jain" href="http://home.in.tum.de/~jain/index.html" target="_blank">site</a> you can find few more tools and utils that he wrote.</p>
<p>Here is the backup link just in case <a class="downloadlink" href="http://blog.amarkulo.com/wp-content/plugins/download-monitor/download.php?id=9" title=" downloaded 19 times" >Mirror 1.43 (19)</a>.</p>
<hr>
<p><div class="entry-utility">If you don't already have a <a href="http://db.tt/aqrG0tY">Dropbox</a> account then you can create it by clicking on my <a href="http://db.tt/aqrG0tY">affiliate link</a>. You will receive 2GB free account + 250 MB extra and I will receive 250 MB as well. Win-Win :-)</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amarkulo.com/synchronize-directories/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating simple cleanup scripts on Windows 2003</title>
		<link>http://blog.amarkulo.com/cleanup-scripts</link>
		<comments>http://blog.amarkulo.com/cleanup-scripts#comments</comments>
		<pubDate>Mon, 10 Nov 2008 14:05:46 +0000</pubDate>
		<dc:creator>amar</dc:creator>
				<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[bat]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[clean up]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[forfiles]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://dzo.blogsite.org/?p=175</guid>
		<description><![CDATA[Here is one short tip. If you had problem with old log files that are being held on system after too much time and wanted to delete all of them automatically here is explanation how to do it. open notepad &#8230; <a href="http://blog.amarkulo.com/cleanup-scripts">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is one short tip. If you had problem with old log files that are being held on system after too much time and wanted to delete all of them automatically here is explanation how to do it.</p>
<ol>
<li>open notepad</li>
<li>write this line in it <strong>Forfiles -p &#8220;c:\temp&#8221; -s -m *.log -d -14 -c &#8220;Cmd /C del @FILE&#8221;</strong></li>
<li>save file and then change it extension from .txt to .bat</li>
</ol>
<p>So here we have batch file created that will do following:</p>
<ul>
<li>find all <strong>.log</strong> files in <strong>c:\temp</strong> path</li>
<li>older than <strong>14 days</strong></li>
<li>and <strong>delete </strong>them</li>
</ul>
<p>Here is small explanation of the command line:</p>
<ul>
<li><strong>-p &#8220;full path&#8221; </strong>is used to specify exact path to the destination dir, it can be c:\ or c:\temp</li>
<li><strong>-s </strong>says to forfiles that it will go recursive into subdirs</li>
<li><strong>-m *.ext </strong>creates filter for files of the <strong>.ext </strong>extension, it can be<strong> *.* </strong>as well</li>
<li><strong>-d 7</strong> says to forfiles to filter files from output above to match current date minus number of days</li>
<li><strong>-c &#8220;command&#8221;</strong> executes command on files that are returned from output of forfiles command</li>
<li><strong>cmd /c command</strong> is saying to <strong>cmd</strong> that is command prompt to execute command and terminate itself</li>
</ul>
<p>Now to test this batch file you can delete or comment out command part so you will get output from forfiles only without deleting of the files. Also you can use move command instead of del to move logfiles to another location.</p>
<p>If everything works like it should open Start-&gt;Control panel-&gt;Scheduled tasks and create new task to executes every day or in any time frame that you want.</p>
<hr>
<p><div class="entry-utility">If you don't already have a <a href="http://db.tt/aqrG0tY">Dropbox</a> account then you can create it by clicking on my <a href="http://db.tt/aqrG0tY">affiliate link</a>. You will receive 2GB free account + 250 MB extra and I will receive 250 MB as well. Win-Win :-)</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amarkulo.com/cleanup-scripts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

