<?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>Dwarfsoft [GPA] &#187; Study</title>
	<atom:link href="http://www.dwarfsoft.com/blog/category/study/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dwarfsoft.com/blog</link>
	<description>Great Programming Artistry</description>
	<lastBuildDate>Tue, 22 Jun 2010 21:01:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Back Behind the Keyboard</title>
		<link>http://www.dwarfsoft.com/blog/2009/07/20/back-behind-the-keyboard/</link>
		<comments>http://www.dwarfsoft.com/blog/2009/07/20/back-behind-the-keyboard/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 04:31:21 +0000</pubDate>
		<dc:creator>dwarfsoft</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Study]]></category>
		<category><![CDATA[Uni]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Application]]></category>
		<category><![CDATA[Book]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Certification]]></category>
		<category><![CDATA[Daugher]]></category>
		<category><![CDATA[Exam]]></category>
		<category><![CDATA[Graduation]]></category>
		<category><![CDATA[GTD]]></category>
		<category><![CDATA[Novell]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[PyTA]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[TED]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://www.dwarfsoft.com/blog/?p=252</guid>
		<description><![CDATA[It has again been some time since my last update. I have been quite busy getting used to balancing my new life with my daughter now nearly 3 months old. Fatherhood has obviously taken a lot of my time that I previously used for development, and learning.
The past few months have also seen my University [...]]]></description>
			<content:encoded><![CDATA[<p>It has again been some time since my last update. I have been quite busy getting used to balancing my new life with my daughter now nearly 3 months old. Fatherhood has obviously taken a lot of my time that I previously used for development, and learning.</p>
<p>The past few months have also seen my University Graduation 3 days after my Daughters Birth, Family Visits, Job Applications, Job Interviews, and finally Permanency in my Servers Position.</p>
<p>Aside from that I have been working with some friends on converting the old TA Server to the C# .Net/Python version (PyTA). I have also been busy in mapping out my development goals and objectives for the coming months and years.</p>
<p><span id="more-252"></span></p>
<div class="wp-caption alignright" style="width: 84px"><a href="http://www.amazon.com/dp/0142000280?tag=dwgp-20&amp;camp=213381&amp;creative=390973&amp;linkCode=as4&amp;creativeASIN=0142000280&amp;adid=0VNZXPFS9EAVTH6R7JM5&amp;"><img title="David Allens Getting Things Done" src="http://rcm-images.amazon.com/images/I/4104N6ME70L._SL110_.jpg" alt="David Allens Getting Things Done" width="74" height="110" /></a><p class="wp-caption-text">David Allens Getting Things Done</p></div>
<p>In order to better manage my time and my priorities I have been implementing and reviewing <a href="http://www.davidco.com/">David Allen&#8217;s</a> &#8220;Getting Things Done&#8221;, and have been operating my own install of GTD-PHP. I have been using this to manage all aspects of my life, from professional to personal projects. This has allowed me a lot greater control of my personal and professional life and allowed me to manage my time far more effectively than ever before. Currently in this system I am managing 100 Active Projects, 44 Someday/Maybe Projects, and within those I have currently 147 Actions within those. I am still in the process of determining Next actions for some of these projects, but at least having visibility of all these things I need to do has given me greater control of managing the most important of these. Most of the projects without next actions are someday/maybe projects, and the others that are not could be put in someday/maybe until such time as I have time to process their next actions. I definitely encourage anybody to try this method of organisation, time management, prioritisation because it has helped me to lower my stress and be able to switch off from work when I get home. Just note that it does tend to increase the likelihood of adding more projects to your list than you started out doing <img src='http://www.dwarfsoft.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>Aside from this I have been attempting to build an Application Audit script at work that will pull the NAL objects from our system through LDAP. I have started coding this type of script now as a class which is in a .vbs file and then for implementing its use I have started using .wsf files to include and execute the required code. This adds to the usability of my existing code and makes my code far more acccessible for reuse in other applications. I had already started writing these types of classes before for my Ini File Handler, but previously I had been including the VBScript files internally using a manual Include function:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Function</span> Include<span style="color: #000000;">&#40;</span>vbsFile<span style="color: #000000;">&#41;</span>
   <span style="color: #FF8000;">Set</span> fso <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Scripting.FileSystemObject&quot;</span><span style="color: #000000;">&#41;</span>
   <span style="color: #0600FF;">If</span> fso.<span style="color: #0000FF;">FileExists</span><span style="color: #000000;">&#40;</span>vbsFile<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
      <span style="color: #FF8000;">Set</span> f <span style="color: #008000;">=</span> fso.<span style="color: #0000FF;">OpenTextFile</span><span style="color: #000000;">&#40;</span>vbsFile<span style="color: #000000;">&#41;</span>
      s <span style="color: #008000;">=</span> f.<span style="color: #0000FF;">ReadAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
      f.<span style="color: #0600FF;">Close</span>
      ExecuteGlobal s
   <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></pre></div></div>

<p>The .wsf include method is so much cleaner:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">language</span>=<span style="color: #ff0000;">&quot;VBScript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;Applications.vbs&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>When I have managed to get my projects and actions further under control I will have to provide updates. I have some plans for the XNA in a Day series which I started with breakout, but that is some way off. I am also planning on overhauling some of my previous projects and actually actioning them. </p>
<p>Cheers, Chris.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwarfsoft.com/blog/2009/07/20/back-behind-the-keyboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manipulating CSV Files &#8211; Part 1</title>
		<link>http://www.dwarfsoft.com/blog/2008/09/09/manipulating-csv-files-part-1/</link>
		<comments>http://www.dwarfsoft.com/blog/2008/09/09/manipulating-csv-files-part-1/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 04:44:46 +0000</pubDate>
		<dc:creator>dwarfsoft</dc:creator>
				<category><![CDATA[Certification]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[Novell]]></category>
		<category><![CDATA[Politics]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Study]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[MCSA]]></category>
		<category><![CDATA[MCSA Messaging]]></category>
		<category><![CDATA[MCSE]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Workstation]]></category>

		<guid isPermaLink="false">http://www.dwarfsoft.com/blog/?p=67</guid>
		<description><![CDATA[Before I jump in to the fun that is the Scripting that I have been wading through this past week, I thought I&#8217;d let all of those who may care that I finally have some kind of certification. I passed Microsoft exams 70-291 and 70-284. So I am now the proud holder of a Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p>Before I jump in to the fun that is the Scripting that I have been wading through this past week, I thought I&#8217;d let all of those who may care that I finally have some kind of certification. I passed Microsoft exams 70-291 and 70-284. So I am now the proud holder of a Microsoft Certified Systems Administrator Messaging Specialist certification (MCSA Messaging). Now I am concentrating on the final three exams so that I can get my MCSE.</p>
<p>After a rather hectic week of scripting a solution and then distributing it under an excessively short deadline, I have been asked to provide stats on the result of forcing this solution out to clients. The solution that I had to develop keeps tabs on a System Volume Image of PCs, and ensures that this Image never gets out of date too far. Currently I am not forcing a Store every restart, as the planned solution was to do, but I do inform the client that their current Image is out of date and ask them if they want to do a Store now. If they click on Yes then their PC is rebooted and the Store is done (providing that one of many flaws in the current Store process do not interrupt the process).<span id="more-67"></span></p>
<p>Because of some of the issues that we have had, as well as Managements want to view the impact of what we have done in a statistical format, I was required to provide a secondary application, which is just an updated version of an AutoIT Script that logs the Image Date into a log file during login. Because this file was preexisting it has been used in this way to gather stats for some time.</p>
<p>The issue is that the log file includes EVERY instance of a login for a PC, and I want only the most recent with the timestamp of the image, not all the other instances, or the log values that are too old (I was unable to clear the logs due to current procedure). Therefore I was required to learn some new things in the VBScript world. This solution is surprisingly fast considering how much data it is required to crunch in order to produce the output CSV file.</p>
<pre>Const ForReading = 1
Const ForWriting = 2

Dim arrLines()
i = 0

Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")

objStartFolder = WScript.ScriptFullNameobjStartFolder = Replace  (objStartFolder, WScript.ScriptName, "") 

Set objFolder = objFSO.GetFolder(objStartFolder &amp; "Logs")

Set colFiles = objFolder.Files
For Each objFile in colFiles
    Set textFile = objFSO.OpenTextFile(objFile.Path, ForReading)

    Do Until textFile.AtEndOfStream
        Redim Preserve arrLines(i)
        arrLines(i) = textFile.ReadLine
        i = i + 1
    Loop

    For i = Ubound(arrLines) to LBound(arrLines) Step -1
        splt = Split (arrLines(i),",")

        If (UBound(splt) &lt; 19) Then
            i = LBound(arrLines)
        Else
            If Splt(19) &lt;&gt; "" Then
               If Not objDictionary.Exists(splt(1)) Then
                  objDictionary.Add splt(1),splt(19)
               End If
            End If
        End If
    Next

    ReDim arrLines(0)
    i = 0
    textFile.Close
Next

Set writeFile = objFSO.CreateTextFile(objStartFolder &amp; "Stores.csv")
For Each strKey in objDictionary.Keys
   writeFile.WriteLine strKey &amp; "," &amp; objDictionary.Item(strKey)
Next
writeFile.Close</pre>
<p>In this particular script the splt Array has 20 columns (or 19 for those items that were prior to me updating the script). Column 2 (or splt(1)) is the PC Name, and Column 20 (or splt(19)) is the Timestamp of the Image. This script reads through every file in the Logs folder (in the same path as the script) and reads the file in reverse until it comes across the entries with only 19 columns. For every unique PC Name that it finds it adds this into a Dictionary object with the Timestamp as the value. The Dictionary is then written to the new CSV file one at a time.</p>
<p>In order to get the stats on how effective this has been, I paste a couple of Excel Macros:</p>
<pre>=COUNTIF(B:B,"&gt;22/08/2008")
=COUNT(B:B)</pre>
<p>The magic date here is the 22nd of August 2008. This was chosen purely because it was a recent date, and it was newer than most of the Images for the PCs within the IT Department, who already had the AutoStore scripts working on their machines. Which provided for a controlled Environment for testing some of the modifications I was forced to make last minute.</p>
<p>One thing that I could do to improve the accuracy of this script is to pull out all the Workstation Names from Novell using LDAP and get a total overall status of where the Store dates are across all PCs, but that would pollute the pool with a large number of machines that have been decommissioned (they still appear as a Workstation in Novell until they have not been logged on to for 3 months, then they fall off the system).</p>
<p>On a side note, I have to pull in the Logs into the Logs directory in some way, which is achieved for me by running a Batch file which I have written as follows:</p>
<pre>@ECHO OFF
ECHO Pulling Logs %DATE% - %TIME%&gt;&gt;Log.txt
ECHO.&gt;&gt;Log.txt
%~d0
cd %~dp0
FOR /F "tokens=*" %%A IN (Sources.txt) DO (
  FOR /F "tokens=1 delims=" %%Z IN ("%%A") DO (
     COPY "%%AlogsLogIn.csv" "%~dp0Logs%%Z.csv" /A /D /Y /Z &gt;&gt;Log.txt
  )
)
ECHO.&gt;&gt;Log.txt
ECHO Current Stores being Rebuilt at %DATE - %TIME%&gt;&gt;Log.txt
WScript Stores.vbs
Start Excel Stores.csv
ECHO Log Pull Finished at %DATE% - %TIME%&gt;&gt;Log.txt</pre>
<p>This script uses a file called &#8220;Sources.txt&#8221; which is a list of paths on newlines which point to where each of the Logs are stored. Each line consists of something like \ServerNameSYSPUBLIC. The line FOR /F &#8220;tokens=1 delims=&#8221; %%Z IN (&#8220;%%A&#8221;) allows me to pull out the servername from each line in the file, so that when I copy the file from the server, I can rename it so that its source can be identified.</p>
<p>I think this will conclude todays lesson in VBScript and Batch, and I&#8217;d best get back to studying.</p>
<p>Cheers, Chris.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwarfsoft.com/blog/2008/09/09/manipulating-csv-files-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Return to GetVolumeNumber</title>
		<link>http://www.dwarfsoft.com/blog/2008/09/02/return-to-getvolumenumber/</link>
		<comments>http://www.dwarfsoft.com/blog/2008/09/02/return-to-getvolumenumber/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 13:30:47 +0000</pubDate>
		<dc:creator>dwarfsoft</dc:creator>
				<category><![CDATA[Novell]]></category>
		<category><![CDATA[Politics]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Study]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Auto Store]]></category>
		<category><![CDATA[AutoStore]]></category>
		<category><![CDATA[Mount]]></category>
		<category><![CDATA[Mount Points]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Volume]]></category>

		<guid isPermaLink="false">http://www.dwarfsoft.com/blog/?p=62</guid>
		<description><![CDATA[Since my last post I came to the realisation that I really didn&#8217;t like the way that the Diskpart box popped up on screen during the function call, so I did what I said I should have done and created the function the other way. This also cleans up the text files after completion, which [...]]]></description>
			<content:encoded><![CDATA[<p>Since my last post I came to the realisation that I really didn&#8217;t like the way that the Diskpart box popped up on screen during the function call, so I did what I said I should have done and created the function the other way. This also cleans up the text files after completion, which is something the previous function didn&#8217;t do.</p>
<p>For completeness I also made the function a little more generic, so it takes the Volume Label as the Variable, and falls back to &#8220;IMAGE&#8221; if none was passed.</p>
<p><span id="more-62"></span></p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Function</span> GetVolumeNumberHidden<span style="color: #000000;">&#40;</span>Label<span style="color: #000000;">&#41;</span>
   <span style="color: #FF8000;">On</span> <span style="color: #FF8000;">Error</span> <span style="color: #FF8000;">Resume</span> <span style="color: #FF8000;">Next</span>
   <span style="color: #0600FF;">Const</span> <span style="color: #0600FF;">ForWriting</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span>
   <span style="color: #0600FF;">Const</span> <span style="color: #0600FF;">ForReading</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span>
&nbsp;
   <span style="color: #0600FF;">If</span> Label<span style="color: #008000;">=</span><span style="color: #808080;">&quot;&quot;</span> <span style="color: #FF8000;">Then</span>
      Label<span style="color: #008000;">=</span><span style="color: #808080;">&quot;IMAGE&quot;</span>
   <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
   <span style="color: #FF8000;">Set</span> oShell <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;WScript.Shell&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
   <span style="color: #FF8000;">Set</span> oFSO <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Scripting.FileSystemObject&quot;</span><span style="color: #000000;">&#41;</span>
   TempFile <span style="color: #008000;">=</span> oShell.<span style="color: #0000FF;">ExpandEnvironmentStrings</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;C:\Temp\dp.txt&quot;</span><span style="color: #000000;">&#41;</span>
   ListFile <span style="color: #008000;">=</span> oShell.<span style="color: #0000FF;">ExpandEnvironmentStrings</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;C:\Temp\dl.txt&quot;</span><span style="color: #000000;">&#41;</span>
   <span style="color: #FF8000;">Set</span> oFile <span style="color: #008000;">=</span> oFSO.<span style="color: #0000FF;">OpenTextFile</span><span style="color: #000000;">&#40;</span>TempFile,<span style="color: #0600FF;">ForWriting</span>,<span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span>
&nbsp;
   oFile.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LIST VOLUME&quot;</span><span style="color: #000000;">&#41;</span>
   oFile.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
   oShell.<span style="color: #0000FF;">Run</span> <span style="color: #808080;">&quot;%comspec% /c diskpart /s &quot;</span> <span style="color: #008000;">&amp;</span>amp; TempFile <span style="color: #008000;">&amp;</span>amp; _
      <span style="color: #808080;">&quot; &amp;gt; &quot;</span> <span style="color: #008000;">&amp;</span>amp; ListFile, <span style="color: #FF0000;">0</span>, <span style="color: #0600FF;">True</span>
&nbsp;
   Ouptut <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
   <span style="color: #0600FF;">Str</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
&nbsp;
   <span style="color: #FF8000;">Set</span> oFile <span style="color: #008000;">=</span> oFSO.<span style="color: #0000FF;">OpenTextFile</span><span style="color: #000000;">&#40;</span>ListFile,<span style="color: #0600FF;">ForReading</span><span style="color: #000000;">&#41;</span>
&nbsp;
   <span style="color: #0600FF;">Do</span> until oFile.<span style="color: #0000FF;">AtEndOfStream</span>
      <span style="color: #0600FF;">Str</span> <span style="color: #008000;">=</span> oFile.<span style="color: #0000FF;">ReadLine</span>
      <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #808080;">&quot;Volume&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>gt; <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
         <span style="color: #0600FF;">If</span> <span style="color: #804040;">Not</span> <span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">10</span>,<span style="color: #FF0000;">3</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;###&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
            DriveLetter <span style="color: #008000;">=</span> <span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">16</span>,<span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>
            VolumeNumber <span style="color: #008000;">=</span> <span style="color: #0600FF;">Trim</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">10</span>,<span style="color: #FF0000;">3</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">StrComp</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Trim</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">20</span>,<span style="color: #FF0000;">12</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>,<span style="color: #0600FF;">Trim</span><span style="color: #000000;">&#40;</span>Label<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">=</span><span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
               GetVolumeNumberHidden <span style="color: #008000;">=</span> VolumeNumber
&nbsp;
               oFile.<span style="color: #0600FF;">Close</span>
               <span style="color: #0600FF;">If</span> oFSO.<span style="color: #0000FF;">FileExists</span><span style="color: #000000;">&#40;</span>TempFile<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                  oFSO.<span style="color: #0000FF;">DeleteFile</span> TempFile, <span style="color: #0600FF;">True</span>
               <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
               <span style="color: #0600FF;">If</span> oFSO.<span style="color: #0000FF;">FileExists</span><span style="color: #000000;">&#40;</span>ListFile<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                  oFSO.<span style="color: #0000FF;">DeleteFile</span> ListFile, <span style="color: #0600FF;">True</span>
               <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
               <span style="color: #0600FF;">Exit</span> <span style="color: #0600FF;">Function</span>
            <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
         <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
      <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
   <span style="color: #0600FF;">Loop</span>
&nbsp;
   oFile.<span style="color: #0600FF;">Close</span>
   <span style="color: #0600FF;">If</span> oFSO.<span style="color: #0000FF;">FileExists</span><span style="color: #000000;">&#40;</span>TempFile<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
      oFSO.<span style="color: #0000FF;">DeleteFile</span> TempFile, <span style="color: #0600FF;">True</span>
   <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
   <span style="color: #0600FF;">If</span> oFSO.<span style="color: #0000FF;">FileExists</span><span style="color: #000000;">&#40;</span>ListFile<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
      oFSO.<span style="color: #0000FF;">DeleteFile</span> ListFile, <span style="color: #0600FF;">True</span>
   <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></pre></div></div>

</p>
<p>This function now makes its way into the Completed stage and now I move on to other things. I have been working very frantically on my AutoStore script. This function is used in both the Store/Restore installation, and the AutoStore script itself, in order to get the timestamp of the previously stored image files. Some of the other fun things I have been playing with involve Novell Workstation Policy Packages, and Package Schedules. In order to initiate the AutoStore process I have created an array of Package Schedules that calls my AutoImage.vbe file. I noticed that during the process of Installation, the MSI had not completed before the AutoImage.vbe file was attempted to be run. This lead to a WScript error because the target file did not exist. I modified the run information to the following:</p>

<div class="wp_syntax"><div class="code"><pre class="winbat" style="font-family:monospace;">C:\Windows\System32\cmd.exe /c &quot;if exist (
   C:\SOE\AUTOSTORE\AutoImage.vbe) (
      start wscript C:\SOE\AUTOSTORE\AutoImage.vbe Interval=14 Force )&quot;</pre></div></div>

<p>At first glance it may seem that some of this can be discarded, however it is all required. In order to first check that the file exists without requiring ANY script to have been installed onto the target machine we need to use &#8220;<strong>if exist</strong>&#8221; which requires running through cmd.exe because it is a command interpreter command, not a stand alone executable. If we do not use <strong>Start</strong> then the command screen stays open while the script runs, or while a popup box explaining to users that they need to reboot is displayed. This appears a disjointed visually and lead to me wanting to close all those blank black windows. WScript does not explicitly need to be called, but since I want to specify WScript instead of CScript I have included it for completeness sake.</p>
<p>In order that the command window does not show up for most of the background calls to the script I have ensured that it runs in the SYSTEM security space. The Unsecure System space is used only for those functions where the script requires user input or provides user feedback. This limits the interruption to the general use of the PCs.</p>
<p>I spent much of the past few days creating and modifying the scripts, and I spent all afternoon packaging the script into the MSI and creating the Policy Packages. I have also now documented the Policy Package creation process and documented the usage of the script. Hopefully I can get it all slapped together and rolled out, as we need to force a store before Monday, when an updated software package is being forced out. I have to love the communication we get prior to these things. I have had to kill myself to get the modifications done to their current point, and as yet they are untested for machines which have not received some of the custom modifications we have implemented. All will come to light tomorrow.</p>
<p>Cheers, Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwarfsoft.com/blog/2008/09/02/return-to-getvolumenumber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSI Installer Limitations</title>
		<link>http://www.dwarfsoft.com/blog/2008/08/28/msi-installer-limitations/</link>
		<comments>http://www.dwarfsoft.com/blog/2008/08/28/msi-installer-limitations/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 00:54:06 +0000</pubDate>
		<dc:creator>dwarfsoft</dc:creator>
				<category><![CDATA[Novell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Study]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[DiskPart]]></category>
		<category><![CDATA[Mount]]></category>
		<category><![CDATA[Mount Points]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Volume]]></category>

		<guid isPermaLink="false">http://www.dwarfsoft.com/blog/?p=58</guid>
		<description><![CDATA[I have spent the last few days creating a few MSI packages and fixing some pre-existing MSI packages. One issue that I found with working on an MSI that installs files to a Hidden partition is that InstallShield has very little in the way of control over partitions, mountpoints and the like. This was not [...]]]></description>
			<content:encoded><![CDATA[<p>I have spent the last few days creating a few MSI packages and fixing some pre-existing MSI packages. One issue that I found with working on an MSI that installs files to a Hidden partition is that InstallShield has very little in the way of control over partitions, mountpoints and the like. This was not really an issue, as I am using a SOE and can Mount Volumes through VBScript.</p>
<p>The one issue that we had with mounting this specific Volume is that if a USB Drive or a Virtual CD/DVD drive is installed on the machine, it modifies the volume numbering scheme. The volume we were previously attempting to mount was Volume 3. This became Volume 4 in the even that another drive was connected, or a higher number depending on how the USB drive was partitioned.</p>
<p>Not a grand issue, but one that was overlooked by the Corporate boys when they released one of their imaging tools (the hidden volume is the Image volume). I modified their install script to use a bit more smarts when attempting to find the volume it needs.<span id="more-58"></span></p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Function</span> GetImageVolumeNumber
   <span style="color: #FF8000;">On</span> <span style="color: #FF8000;">Error</span> <span style="color: #FF8000;">Resume</span> <span style="color: #FF8000;">Next</span>
   <span style="color: #0600FF;">Const</span> <span style="color: #0600FF;">ForWriting</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span>
   <span style="color: #0600FF;">Const</span> <span style="color: #0600FF;">ForReading</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span>
&nbsp;
   <span style="color: #FF8000;">Set</span> oShell <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;WScript.Shell&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
   <span style="color: #FF8000;">Set</span> oFSO <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Scripting.FileSystemObject&quot;</span><span style="color: #000000;">&#41;</span>
   <span style="color: #FF8000;">Set</span> oFile <span style="color: #008000;">=</span> oFSO.<span style="color: #0000FF;">OpenTextFile</span><span style="color: #000000;">&#40;</span> 
      oShell.<span style="color: #0000FF;">ExpandEnvironmentStrings</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;C:\Temp\dp.txt&quot;</span><span style="color: #000000;">&#41;</span>,<span style="color: #0600FF;">ForWriting</span>,<span style="color: #0600FF;">True</span> <span style="color: #000000;">&#41;</span>
&nbsp;
   oFile.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LIST VOLUME&quot;</span><span style="color: #000000;">&#41;</span>
   oFile.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
   <span style="color: #FF8000;">set</span> proc <span style="color: #008000;">=</span> oShell.<span style="color: #0000FF;">Exec</span> <span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;diskpart /s C:\Temp\dp.txt&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
   Ouptut <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
   <span style="color: #0600FF;">Str</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
&nbsp;
   <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">while</span> <span style="color: #804040;">Not</span> proc.<span style="color: #0000FF;">StdOut</span>.<span style="color: #0000FF;">AtEndOfStream</span>
      <span style="color: #0600FF;">Str</span> <span style="color: #008000;">=</span> proc.<span style="color: #0000FF;">StdOut</span>.<span style="color: #0000FF;">ReadLine</span>
      <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #808080;">&quot;Volume&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>gt; <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
         <span style="color: #0600FF;">If</span> <span style="color: #804040;">Not</span> <span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">10</span>,<span style="color: #FF0000;">3</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;###&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
            DriveLetter <span style="color: #008000;">=</span> <span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">16</span>,<span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>
            VolumeNumber <span style="color: #008000;">=</span> <span style="color: #0600FF;">Trim</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">10</span>,<span style="color: #FF0000;">3</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">StrComp</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Mid</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Str</span>,<span style="color: #FF0000;">20</span>,<span style="color: #FF0000;">5</span><span style="color: #000000;">&#41;</span>,<span style="color: #808080;">&quot;IMAGE&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">=</span><span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
               GetImageVolumeNumber <span style="color: #008000;">=</span> VolumeNumber
               <span style="color: #0600FF;">Exit</span> <span style="color: #0600FF;">Function</span>
            <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
         <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
      <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
   <span style="color: #0600FF;">Loop</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></pre></div></div>

<p>This function simply uses the output from DiskPart in order to find the number of the volume named &#8220;IMAGE&#8221;. This is then returned to the call point and can be used in place of the previous DiskPart calls to &#8220;SELECT VOLUME 3&#8243; and &#8220;ASSIGN MOUNT=C:\Temp\Image&#8221;. The only issue with this Shell Exec call is that it cannot be hidden, as then we cannot retrieve the output. This is not a real issue as the Console screen should just flash up and close quickly. Alternatively I could have fed the output into a text file and read it from that, but part of me is always interested in seeing new ways to do things, which was reading from StdOut in this instance.</p>
<p>So this leaves my MSI to be a shell that copies files to an &#8220;install&#8221; location, then runs a VBScript that mounts the volume and copies those files to the Image Drive. Not ideal, but the best solution I have at the moment. The Corporate guys are considering implementing this in the next version of the Imaging Tool, but in the meantime I will simply replace all the buggy files for my own Administrative Area.</p>
<p>Oh, and I know somebody is going to mention the Shell ExpandEnvironmentStrings call that is unneccessary. This is because it was originally using %temp%. I left it there for now in case I start using %temp% again. Then I can just do a find-replace for &#8220;C:\Temp&#8221; to &#8220;%Temp%&#8221; to return it to its previous functionality.</p>
<p>Cheers, Chris.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwarfsoft.com/blog/2008/08/28/msi-installer-limitations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MCSA Study</title>
		<link>http://www.dwarfsoft.com/blog/2008/08/17/mcsa-study/</link>
		<comments>http://www.dwarfsoft.com/blog/2008/08/17/mcsa-study/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 13:46:48 +0000</pubDate>
		<dc:creator>dwarfsoft</dc:creator>
				<category><![CDATA[Certification]]></category>
		<category><![CDATA[Study]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[70-284]]></category>
		<category><![CDATA[70-290]]></category>
		<category><![CDATA[70-291]]></category>
		<category><![CDATA[CCNA]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[CNA]]></category>
		<category><![CDATA[Cram]]></category>
		<category><![CDATA[Exam]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[MCSA]]></category>
		<category><![CDATA[MCSE]]></category>
		<category><![CDATA[Novell]]></category>

		<guid isPermaLink="false">http://www.dwarfsoft.com/blog/?p=51</guid>
		<description><![CDATA[I haven&#8217;t updated you all for a while, but in that time I have completed Microsoft exam 70-290. This ended up being quite a lot simpler than I had originally anticipated. I am currently studying for two more exams. 70-291, which is Microsoft Windows 2003 Networking, and 70-284, which is Microsoft Exchange Server 2003 configuration. [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t updated you all for a while, but in that time I have completed Microsoft exam 70-290. This ended up being quite a lot simpler than I had originally anticipated. I am currently studying for two more exams. 70-291, which is Microsoft Windows 2003 Networking, and 70-284, which is Microsoft Exchange Server 2003 configuration. I have been attempting the practice exams and reading the MSPress books, and am relatively confident.</p>
<p>I have scheduled both of these exams for the same day, which will make the day a very long one. If I manage to pass both then that will give me MCSA: Messaging Specialist status. I can then focus on the remaining 3 exams to get my full MCSE certification.</p>
<p><span id="more-51"></span></p>
<p>I hope to get around to completing my Novell CNA exam at some point soon as well. Or once I have the MCSE I might concentrate on the Cisco CCNA. This will give me the required certification level in order to work overseas.</p>
<p>There are still 2 weeks until the exams, so time to start cramming as much study as I can in.</p>
<p>Cheers, Chris.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwarfsoft.com/blog/2008/08/17/mcsa-study/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
