<?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>Teh Tech &#187; Pause</title>
	<atom:link href="http://tehtech.com/tag/pause/feed/" rel="self" type="application/rss+xml" />
	<link>http://tehtech.com</link>
	<description>Being an Admin is Hard Enough</description>
	<lastBuildDate>Wed, 14 Jul 2010 16:14:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Inserting a Wait in a Batch File, Using Netstat in a Login Script</title>
		<link>http://tehtech.com/inserting-a-wait-in-a-batch-file-using-netstat-in-a-login-script/</link>
		<comments>http://tehtech.com/inserting-a-wait-in-a-batch-file-using-netstat-in-a-login-script/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 16:50:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[Login Script]]></category>
		<category><![CDATA[Netstat]]></category>
		<category><![CDATA[Pause]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=91</guid>
		<description><![CDATA[So you want to pause a batch file for a few seconds.  Unfortunately windows doesn&#8217;t provide a very simple way of doing this.   I wanted to run &#8216;netstat -b&#8217; 25 seconds after a user logged into their computer as to give the computer enough time to start up all background applications.  But, there is no [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to pause a batch file for a few seconds.  Unfortunately windows doesn&#8217;t provide a very simple way of doing this.   I wanted to run &#8216;netstat -b&#8217; 25 seconds after a user logged into their computer as to give the computer enough time to start up all background applications.  But, there is no wait function in batch files.  Well I found a workaround.  If you use the &#8216;-n&#8217; argument with the ping command you can specify the amount of time to run a ping for.  Thus ping -n 60 127.0.0.1 will ping your local host for 60 seconds.  This will more or less keep the batch file at a standstill for a specified number of seconds before continuing.  In my case I used it for a pause in a login script.<br />
<span id="more-91"></span></p>
<div class="box">echo off<br />
title login script<br />
color 1f<br />
set name=%computername%<br />
ping -n 25 127.0.0.1<br />
echo %computername% &gt;&gt; g:\%name%.log<br />
date /T &gt;&gt; g:\%name%.log<br />
time /T &gt;&gt; g:\%name%.log<br />
netstat -b &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log<br />
echo *********************************************** &gt;&gt; g:\%name%.log</div>
<p> <br />
In this script the &#8216;G&#8217; Drive is a mapped drive for administration.  When a user logs in they will open the log stamp it with their computer name, the date and the time.  Then the netstat output, followed by a few lines of asterisks to separate the uses visually.  I have an OU with this script applied to it.  If I suspect a user is doing something sketchy I add them to this OU, to do a little snooping.</p>
<p>[ad]</p>
]]></content:encoded>
			<wfw:commentRss>http://tehtech.com/inserting-a-wait-in-a-batch-file-using-netstat-in-a-login-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
