 




<?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>The VBScript Network and Systems Administrator&#039;s Cafe &#187; VBScipt</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/vbscipt/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator</link>
	<description></description>
	<lastBuildDate>Tue, 11 Oct 2011 18:36:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Using the VBScript datediff function to determine the age of a file by the last modified and the last accessed time</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-vbscript-datediff-function-to-determine-the-age-of-a-file-by-the-last-modified-and-the-last-accessed-time/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-vbscript-datediff-function-to-determine-the-age-of-a-file-by-the-last-modified-and-the-last-accessed-time/#comments</comments>
		<pubDate>Sat, 02 May 2009 18:19:29 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Disk space]]></category>
		<category><![CDATA[disk utilities]]></category>
		<category><![CDATA[file access]]></category>
		<category><![CDATA[file modified]]></category>
		<category><![CDATA[modification date]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[VBScipt]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=245</guid>
		<description><![CDATA[I recently needed a way to tell if a file had been accessed or modified recently, something that has always been a question when you&#8217;re out of space on a server and can&#8217;t just add more space to it. What do you delete??? The Old files are the obvious answer&#8230; except if people are using them. Here [...]]]></description>
				<content:encoded><![CDATA[<p>I recently needed a way to tell if a file had been accessed or modified recently, something that has always been a question when you&#8217;re out of space on a server and can&#8217;t just add more space to it. What do you delete??? The Old files are the obvious answer&#8230; except if people are using them.</p>
<p>Here is teh script I wrote to tell if a file had been accessed or modified in the last X days. In the example I use 5 days, but you can use a different number of days when you call the function.</p>
<p>Enjoy!</p>
<p><span style="color: #0000ff">Option Explicit</span></p>
<p><span style="color: #0000ff">Dim fName<br />
Const DateLastModified = 1, DateLastAccessed = 2</span></p>
<p><span style="color: #0000ff">fName=&#8221;c:\temp2.txt&#8221;</span></p>
<p><span style="color: #0000ff">if FileAge(fname,5,DateLastAccessed) = True Then<br />
WScript.Echo (&#8220;The file was accessed recently enough!&#8221;)<br />
Else<br />
WScript.Echo (&#8220;The file was not accessed recently enough!&#8221;)<br />
End If</span></p>
<p><span style="color: #0000ff">if FileAge(fname,5,DateLastModified) = True Then<br />
WScript.Echo (&#8220;The file was modified recently!&#8221;)<br />
Else<br />
WScript.Echo (&#8220;The file was not modified recently!&#8221;)<br />
End If</span></p>
<p><span style="color: #0000ff">Function FileAge(fName,fAge, CompareType)<br />
&#8216;function returns True if the file is older than the fAge (File Age) specified and false if it isn&#8217;t<br />
Dim LastModified, LastAccessed, FSO, DateDifference</span></p>
<p><span style="color: #0000ff"> Set FSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
LastModified = FSO.GetFile(fname).DateLastModified<br />
LastAccessed = FSO.GetFile(fname).DateLastAccessed</span></p>
<div><span style="color: #0000ff"> Select Case CompareType<br />
Case 1<br />
DateDifference = DateDiff(&#8220;n&#8221;,LastModified, Now())<br />
Case 2<br />
DateDifference = DateDiff(&#8220;n&#8221;,LastAccessed, Now())</p>
<div><span style="color: #0000ff"> End Select<br />
If DateDifference &gt; fage Then<br />
FileAge = False<br />
Else<br />
FileAge = True<br />
End If<br />
End Function</span></div>
<p></span></div>
<div><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></div>
<div><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></div>
<div><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></div>
<p><span style="color: #0000ff"><span style="color: #0000ff"> </span></span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-vbscript-datediff-function-to-determine-the-age-of-a-file-by-the-last-modified-and-the-last-accessed-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing scripts that use speech with the Windows Speech API</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-scripts-that-use-speech-with-the-windows-speech-api/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-scripts-that-use-speech-with-the-windows-speech-api/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 02:01:08 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Office Agent]]></category>
		<category><![CDATA[SAPI.SpVoice]]></category>
		<category><![CDATA[Sound]]></category>
		<category><![CDATA[Speech API]]></category>
		<category><![CDATA[undocumented windows]]></category>
		<category><![CDATA[VBScipt]]></category>
		<category><![CDATA[VBScript Objects]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-scripts-that-use-speech-with-the-windows-speech-api/</guid>
		<description><![CDATA[I&#8217;ve been looking for ways to make a script speak the information it needs to relay to the user just for fun and, unfortunately the only scripts I could find out there were extremely elaborate onces that use the Microsoft Office Agents. While they fit the bill they were annoying and required Microsoft office components [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been looking for ways to make a script speak the information it needs to relay to the user just for fun and, unfortunately the only scripts I could find out there were extremely elaborate onces that use the Microsoft Office Agents. While they fit the bill they were annoying and required Microsoft office components to be installed&#8230; that just wouldn&#8217;t do.</p>
<p>Then I found the Windows Sound API. It doesn&#8217;t require anything at all to be installed and it works fine. The script below is simple and easy to implement in your code. Check it out:</p>
<p><span style="color: #0000ff">strText = &#8220;Hello, there&#8230;. can you write code?&#8221;</span></p>
<p><span style="color: #0000ff">Set objVoice = CreateObject(&#8220;SAPI.SpVoice&#8221;)<br />
objVoice.Speak strText</span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/writing-scripts-that-use-speech-with-the-windows-speech-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the IIS ADSI object to retrieve the anonymous user password for a server via VBScript</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-iis-adsi-object-to-retrieve-the-anonymous-user-password-for-a-server-via-vbscript/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-iis-adsi-object-to-retrieve-the-anonymous-user-password-for-a-server-via-vbscript/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 15:53:56 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[iis]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Toolkit]]></category>
		<category><![CDATA[VBScipt]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>
		<category><![CDATA[working with objects]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-iis-adsi-object-to-retrieve-the-anonymous-user-password-for-a-server-via-vbscript/</guid>
		<description><![CDATA[I recently had to change the anonymous user account for a change request for a site in IIS, but unfortunately the change did not work and we had to roll it back. However, I didn’t have and wouldn’t have known the account’s password since IIS and windows changes it periodically. So, out came the scripting [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had to change the anonymous user account for a change request for a site in IIS, but unfortunately the change did not work and we had to roll it back. However, I didn’t have and wouldn’t have known the account’s password since IIS and windows changes it periodically.</p>
<p>So, out came the scripting tool belt and I found that I had a script written previously that let me get the anonymous user account and password through the IIS ADSI object.</p>
<p>Below is a snippet from the script to display the password.</p>
<p><span style="color: #0000ff">Function Get_IUSR_Password(ServerName)<br />
   Dim IIsObject<br />
   <br />
   Set IIsObject = GetObject (&#8220;IIS://&#8221; &amp; ServerName &amp; &#8220;/w3svc&#8221;)<br />
   on Error resume Next<br />
   Get_IUSR_Password = IIsObject.Get(&#8220;AnonymousUserPass&#8221;)<br />
   On Error GoTo 0<br />
End Function </span></p>
<p>Enjoy!</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/using-the-iis-adsi-object-to-retrieve-the-anonymous-user-password-for-a-server-via-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a unique GUID for use in your VBScripts</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/creating-a-unique-guid-for-use-in-your-vbscripts/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/creating-a-unique-guid-for-use-in-your-vbscripts/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 18:40:00 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[GUID]]></category>
		<category><![CDATA[Scriptlet.TypeLib]]></category>
		<category><![CDATA[VBScipt]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/creating-a-unique-guid-for-use-in-your-vbscripts/</guid>
		<description><![CDATA[Today I answered a question in the ITKE unanswered questions for Word VBA on how to be certain a filename was unique across several users using it. The answer I gave answered the question, but I knew there was a way to create GUID&#8217;s within VBScript but couldn&#8217;t recall how. GUID&#8217;s are cryptic to look [...]]]></description>
				<content:encoded><![CDATA[<p>Today I answered a question in the ITKE unanswered questions for Word VBA on how to be certain a filename was unique across several users using it. The answer I gave answered the question, but I knew there was a way to create GUID&#8217;s within VBScript but couldn&#8217;t recall how.</p>
<p>GUID&#8217;s are cryptic to look at, but they are pretty much guaranteed to be unique. After some research I found the library that provides this functionality&#8230; <strong>Scriptlet.TypeLib</strong>! Below is a short script that gives you an idea of how to use it in your scripts to generate unique strings for when you need a guaranteed unique name or identifier.</p>
<p><span style="color: #0000ff">Option Explicit</span></p>
<p><span style="color: #0000ff">Dim GUID<br />
</span><span style="color: #0000ff">Set TypeLib = CreateObject(&#8220;Scriptlet.TypeLib&#8221;)<br />
GUID = TypeLib.Guid</span></p>
<p>Enjoy!</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/creating-a-unique-guid-for-use-in-your-vbscripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easily compare dates from with in VBScript</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/easily-compare-dates-from-with-in-vbscript/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/easily-compare-dates-from-with-in-vbscript/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 18:11:43 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[date]]></category>
		<category><![CDATA[Date Comparison]]></category>
		<category><![CDATA[DATEDIFF]]></category>
		<category><![CDATA[Dates]]></category>
		<category><![CDATA[VBScipt]]></category>
		<category><![CDATA[VBScript Functions]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/easily-compare-dates-from-with-in-vbscript/</guid>
		<description><![CDATA[On occasion you need to compare two dates in your scripts, this can be a real challenge when you approach the date as if it were a string and/or compare the date parts to one another. Then finding the difference can be a whole other set of challenges if your dates span several months, days, [...]]]></description>
				<content:encoded><![CDATA[<p>On occasion you need to compare two dates in your scripts, this can be a real challenge when you approach the date as if it were a string and/or compare the date parts to one another. Then finding the difference can be a whole other set of challenges if your dates span several months, days, or years.</p>
<p>Luckily, there is a function right into VBScript that helps you compare two dates to one another and returns the difference in a unit of time that you specify! That function is <a href="http://www.w3schools.com/vbScript/func_datediff.asp" target="_blank">the datediff function</a>!</p>
<p>Below is an example that returns the number of seconds, minutes, hours, days, and years between now and February 25, 1973.</p>
<p><span style="color: #0000ff">Option Explicit</span></p>
<p><span style="color: #0000ff">Dim DateThen, DateNow</span></p>
<p><span style="color: #0000ff">DateThen = &#8220;2/25/1973&#8243;<br />
DateNow = Now</span></p>
<p><span style="color: #0000ff">WScript.Echo DateDiff(&#8220;s&#8221;,DateThen, DateNow)<br />
WScript.Echo DateDiff(&#8220;n&#8221;,DateThen, DateNow)<br />
WScript.Echo DateDiff(&#8220;h&#8221;,DateThen, DateNow)<br />
WScript.Echo DateDiff(&#8220;d&#8221;,DateThen, DateNow)<br />
WScript.Echo DateDiff(&#8220;yyyy&#8221;,DateThen, DateNow)<br />
</span></p>
<p>Enjoy!</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/easily-compare-dates-from-with-in-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using special characters in VBScript strings</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/special-characters-in-vbscript-strings/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/special-characters-in-vbscript-strings/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 15:21:52 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[ASCII]]></category>
		<category><![CDATA[Special Characters]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[String manipulation]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[VBScipt]]></category>
		<category><![CDATA[working with variables]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/?p=107</guid>
		<description><![CDATA[I just realized I&#8217;ve been using Visual Basic String constants in my scripts with little to no explanation. We&#8217;ll rectify that situation right now! When dealing with strings in VBScript, you occasionally need to add formatting characters to a string, so that when it is displayed on the screen or in a file it looks [...]]]></description>
				<content:encoded><![CDATA[<p>I just realized I&#8217;ve been using Visual Basic String constants in my scripts with little to no explanation. We&#8217;ll rectify that situation right now! <img src='http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>When dealing with strings in VBScript, you occasionally need to add formatting characters to a string, so that when it is displayed on the screen or in a file it looks correct. If you know your ASCII chart you can certainly preform this with a <em>&#8220;&amp; chr(X) &amp;&#8221;.</em>However, if you don&#8217;t know what ASCII value a tab is (it&#8217;s 9) then you can simply use Visual Basic&#8217;s string constants in your scripts and have the added benefit if making it easier to read!</p>
<p>The constants and their meanings are listed below:</p>
<table border="0">
<tbody>
<tr>
<td>VBTab</td>
<td>A Tab character [Chr(9)]</td>
</tr>
<tr>
<td>VBCr</td>
<td>A carriage return [Chr(13)]</td>
</tr>
<tr>
<td>VBCrLf</td>
<td>A carriage return and line feed [Chr(13) + Chr(10)]</td>
</tr>
<tr>
<td>vbBack</td>
<td>A backspace character [Chr(8)]</td>
</tr>
<tr>
<td>vbLf</td>
<td>A linefeed [Chr(10)]</td>
</tr>
<tr>
<td>vbNewLine</td>
<td>A platform-specific new line character, either [Chr(13) + Chr(10)] or [Chr(13)]</td>
</tr>
<tr>
<td>vbNullChar</td>
<td>A null character of value 0 [Chr(0)]</td>
</tr>
<tr>
<td>vbNullString</td>
<td>A string of value 0 [no Chr code]; note that this is not the same as &#8220;&#8221;</td>
</tr>
</tbody>
</table>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/special-characters-in-vbscript-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
