<?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>Jeff Kastner&#039;s Weblog &#187; RSA</title>
	<atom:link href="http://www.jeffkastner.com/category/rsa/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffkastner.com</link>
	<description>Husband to the most beautiful wife in the world and father to the 2 sweetest kids ever created</description>
	<lastBuildDate>Mon, 26 Jul 2010 18:20:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<atom:link rel="next" href="http://www.jeffkastner.com/category/rsa/feed/?page=2" />

		<item>
		<title>Deliver and Install Applications Remotely With Only a Batch File</title>
		<link>http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/</link>
		<comments>http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:35:45 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[RSA]]></category>

		<guid isPermaLink="false">http://www.jeffkastner.com/?p=193</guid>
		<description><![CDATA[As a Remote Administrator for a software vendor, there’s a popular challenge I often have to overcome; I need to deliver a software package to a lot of computers without using the more popular technologies available. Why the restriction? I generally only maintain the servers that house the software my company builds. That being the case, I don’t get access to such tools as Group Policy, SMS or the latest, greatest SCCM that a lot of IT staffs will use to push out and deploy application installs.]]></description>
			<content:encoded><![CDATA[<p></p><p>As a Remote Administrator for a software vendor, there&#8217;s a popular challenge I often have to overcome; I need to deliver a software package to a lot of computers without using the more popular technologies available. Why the restriction? I generally only maintain the servers that house the software my company builds. That being the case, I don&#8217;t get access to such tools as Group Policy, SMS or the latest, greatest SCCM that a lot of IT staffs will use to push out and deploy application installs. You get the keys to a few locks, but they won&#8217;t give you the keys to the kingdom.</p>
<p>Recently, I was faced with a new challenge. I had a client that was needing to update over 50 workstations at the same time and the updates were starting to come in weekly. Citrix wasn&#8217;t an option for them. As a result, the client would have two people stay after work one night every week and walk to every machine (stretched out between 3 different buildings) and execute the new application install updates. After employing RDP, things went a little faster, as they could sit at their desk and login to every machine remotely. That&#8217;s still not a great option though.</p>
<p>The following is a batch file I wrote that allows an application to be delivered and installed to every computer on the domain by using nothing more than a text file with a list of the computer names. <span id="more-193"></span>To start, you&#8217;ll need to download <a href="http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx" target="new">psexec</a>, an awesome telnet utility from SysInternals (now owned by Microsoft) that allows you to run remote commands on other computers without the need for logging in.  Just drop it in your C:\Windows directory on the server you&#8217;ll be running your batch file on.  No client software to install! </p>
<p>The batch file simply loops through twice.  Using a FOR /F loop, it loops through a text file (called computernames.txt in my example) and copies the install to every computer.  The second time it loops through, psexec executes a command to install.  With the -d option there, it doesn&#8217;t wait around to finish either.  It starts the install and moves right on to the next computer in the list.   Here&#8217;s my code:</p>
<p>[codesyntax lang="winbatch" lines="no" blockstate="collapsed"]</p>
<pre>@REM -- COPY FILES FROM SERVER TO ALL WORKSTATIONS AND DEPLOY --
@echo off
setlocal EnableDelayedExpansion

FOR /F %%N IN (computernames.txt) DO (
  set line=!date! !time! %%N
  XCOPY \\servername\c$\Jeff\installfolder \\%%N\C$\Install\ /y /O /X /E /H /K /I /S &gt;nul 2&gt;&amp;1 || set line=!line! Error
  echo !line!
) &gt;&gt;copyresults.txt

FOR /F %%N IN (computernames.txt) DO (
  set line=!date! !time! %%N
    psexec \\%%N -d -s msiexec /update "C:\Install\Update\MyProgramUpdate_01.1.12345.msp" /qb
)</pre>
<p>[/codesyntax]So there it is, complete with an error checking log on the copy to every computer.  Since we&#8217;re using the -d paramater with psexec, we can&#8217;t use a log to see if psexec worked.  I find this the best way though, as you will otherwise need to wait for each computer to verify execution before moving on&#8230; and this took about a minute p/ computer.  With just a few short lines of code, I managed to give 2 employees the night off every week while I took on the task of installing the software to every workstation in a much shorter time frame.  The install time went from 4 hours (for 2 people) to 1 hour (for 1 person). </p>
<p>OK.. so that works.  But now, with nobody walking around to ensure the success of the installs, how to know if the machines really updated or if there was a problem?  Most programs write to a log of some sort.  I decided to simply use my loop again and go parse the &#8220;Install.log&#8221; file of each computer.  I created the following batch file to achieve this:<br />
[codesyntax lang="winbatch" blockstate="collapsed"]</p>
<pre>@echo off
setlocal EnableDelayedExpansion
FOR /F %%N IN (computernames.txt) DO (
    For /F "tokens=1* delims=," %%A in ('find "2010-02-17"^&lt;\\%%N\C$\Program Files\MyProgram\Logs\Install.log') do (
        &gt;&gt;MASTERLOG.log echo %%N %%A
    )
)</pre>
<p>[/codesyntax]</p>
<p>This will list every computer that has a line in Install.log that begins with the current date (update the date before running it), which is how my install log gets written.  Change yours up accordingly.  If you want to include computers that haven&#8217;t got the log written to it yet, you could include the following after the double-quote at the end of your logfile path:  ^|^|echo ERROR</p>
<p>I was actually surprised how well this all worked when using it in a production environment.  It was faster than I even imagined it would be and my installs can now all be happening at the same time (nearly.. as psexec takes about 3 seconds to execute before going to the next name in the list) with no other user intervention needed.  I plan to streamline this even further in the coming weeks.  I&#8217;ve got a few ideas rolling around&#8230; </p>
<p>See why I love my job?  <img src='http://www.jeffkastner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   I love the opportunity to create solutions&#8230;.</p>
<div class="damn-sexy-bookmarks"><ul class="socials"><li class="damn-sexy-delicious"><a href="http://del.icio.us/post?url=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/&amp;title=Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-digg"><a href="http://digg.com/submit?phase=2&amp;url=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/&amp;title=Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-stumbleupon"><a href="http://www.stumbleupon.com/submit?url=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/&amp;title=Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-technorati"><a href="http://technorati.com/faves?add=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-myspace"><a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/&amp;amp;t=Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-facebook"><a href="http://www.facebook.com/share.php?u=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/&amp;amp;t=Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-twitter"><a href="http://www.twitter.com/home?status=+Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File+-+http://tinyurl.com/yhtcuby" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-linkedin"><a href="http://www.linkedin.com/shareArticle?mini=true&url=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/&title=Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File&summary=As+a+Remote+Administrator+for+a+software+vendor%2C+there%27s+a+popular+challenge+I+often+have+to+overcome%3B+I+need+to+deliver+a+software+package+to+a+lot+of+computers+without+using+the+more+popular+technologies+available.+Why%5B..%5D&source=Jeff Kastner&#039;s Weblog" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-scriptstyle"><a href="http://scriptandstyle.com/submit?url=http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/&amp;title=Deliver+and+Install+Applications+Remotely+With+Only+a+Batch+File" target="_blank" rel="nofollow" title="Array">Array</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.jeffkastner.com/2010/02/deliver-and-install-applications-remotely-with-only-a-batch-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Blat, Stunnel and Gmail Together</title>
		<link>http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/</link>
		<comments>http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 23:20:41 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[RSA]]></category>

		<guid isPermaLink="false">http://www.jeffkastner.com/?p=162</guid>
		<description><![CDATA[I was looking for a way to create quick reminders for myself.  After trying a few different programs, I looked to the command line to see what I could come up with.  It turns out that "command-line email" is perfect for my needs.  By combining Blat, Stunnel and Gmail, you can create a great reminder system for taking quick notes. [click to read more...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I was looking for a way to create quick reminders for myself.  After trying a few different programs, I looked to the command line to see what I could come up with.  It turns out that &#8220;command-line email&#8221; is perfect for my needs.  By combining Blat, Stunnel and Gmail, you can create a great reminder system for taking quick notes. <span id="more-162"></span></p>
<p>I&#8217;ve been a long time fan of <a title="blat.exe" href="http://www.blat.net/" target="_blank">blat</a>, a command line utility that uses SMTP for sending quick messages.  The problem is that a SMTP Server isn&#8217;t always available to every computer.  For awhile, I was loading a separate SMTP Server program on any computer that I needed to use blat on.  I have since found a far easier method.  Enter Gmail.  The geniuses at Google have done it again, allowing the smtp protocol to be used by your Gmail account. </p>
<p>The first step is to download blat and extract the 3 files to your C:\WINDOWS folder.  Next.. download <a title="Stunnel" href="http://www.stunnel.org/" target="_blank">Stunnel</a> to your computer.  I was attempting to setup Gmail&#8217;s SMTP for quite a while before realizing that SSL is required and that&#8217;s why I couldn&#8217;t connect.  This is a good thing though.. as we are now assured the messages we send to Gmail from blat are completely secure.  Stunnel provides the tunnel.  After downloading and installing, you&#8217;ll need to edit your stunnel.conf file with the following settings (yes, just overwrite everything in the file with this):</p>
<blockquote><p># GLOBAL OPTIONS</p>
<p>client = yes<br />
output = stunnel-log.txt<br />
debug = 0<br />
taskbar = no</p>
<p># SERVICE-LEVEL OPTIONS</p>
<p>[SMTP Gmail]<br />
accept = 127.0.0.1:1099<br />
connect = smtp.gmail.com:465</p>
<p>[POP3 Gmail]<br />
accept = 127.0.0.1:1109<br />
connect = pop.gmail.com:995</p></blockquote>
<p>Now, start the service and then &#8216;Run Stunnel&#8217; (both options from Program Files).  Your secure tunnel is established.  (We&#8217;re not actually using POP3 settings since we&#8217;re just interested in creating outgoing (SMTP) mail, but if you setup an email client (Oulook, Thunderbird, etc..), you could enable POP3 in your gmail settings and take advantage of this also. )</p>
<p>Finally, run the <a title="blat command line options" href="http://www.blat.net/syntax/syntax.html" target="_blank">blat command line options</a> to install SMTP to your computer and run the batch file we create for our command line reminders.  Pull up a command prompt and this to install:  <span style="font-family: monospace;">blat -install smtp.gmail.com youremail@gmail.com -u gmailusername -pw gmailpassword &#8211; - gmailsmtp</span></p>
<p>This creates a registry entry with your smtp profile including a gmail encrypted username and password. Next up.. create the batch file that we&#8217;ll call when we type in the command line. It&#8217;s just as simple as this: <span style="font-family: monospace;">c:\windows\blat.exe -p gmailsmtp -to youremail@gmail.com -subject Note: -body %1 -server 127.0.0.1:1099</span></p>
<p>Name your file note.bat and drop it in C:\WINDOWS as well.  Now, pull up a command prompt and type:  note &#8220;here&#8217;s some text to send&#8221;</p>
<p>Check your email.. and there&#8217;s your new note.</p>
<p>Keep in mind that you can send your email to anyone, as you&#8217;re just using the SMTP protocol from a designated gmail account. You also have a huge amount of other options that you could include your batch file so check out the blat syntax. You&#8217;re only limited by what blat can&#8217;t do and blat can do a lot!</p>
<div class="damn-sexy-bookmarks"><ul class="socials"><li class="damn-sexy-delicious"><a href="http://del.icio.us/post?url=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/&amp;title=Using+Blat%2C+Stunnel+and+Gmail+Together" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-digg"><a href="http://digg.com/submit?phase=2&amp;url=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/&amp;title=Using+Blat%2C+Stunnel+and+Gmail+Together" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-stumbleupon"><a href="http://www.stumbleupon.com/submit?url=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/&amp;title=Using+Blat%2C+Stunnel+and+Gmail+Together" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-technorati"><a href="http://technorati.com/faves?add=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-myspace"><a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/&amp;amp;t=Using+Blat%2C+Stunnel+and+Gmail+Together" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-facebook"><a href="http://www.facebook.com/share.php?u=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/&amp;amp;t=Using+Blat%2C+Stunnel+and+Gmail+Together" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-twitter"><a href="http://www.twitter.com/home?status=+Using+Blat%2C+Stunnel+and+Gmail+Together+-+http://tinyurl.com/yengmyh" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-linkedin"><a href="http://www.linkedin.com/shareArticle?mini=true&url=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/&title=Using+Blat%2C+Stunnel+and+Gmail+Together&summary=I+was+looking+for+a+way+to+create+quick+reminders+for+myself.%C2%A0+After+trying+a+few+different+programs%2C+I+looked+to+the+command+line+to+see+what+I+could+come+up+with.%C2%A0+It+turns+out+that+%22command-line+email%22+is+perfect+fo%5B..%5D&source=Jeff Kastner&#039;s Weblog" target="_blank" rel="nofollow" title="Array">Array</a></li><li class="damn-sexy-scriptstyle"><a href="http://scriptandstyle.com/submit?url=http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/&amp;title=Using+Blat%2C+Stunnel+and+Gmail+Together" target="_blank" rel="nofollow" title="Array">Array</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
