Dan Thomson at myITforum.com

Pacifying the call of an undying passion

Syndication

News


    If they don't find you handsome, maybe they'll find you handy (Red Green).
    Proud member of the myITforum Network

Links: Helpful forums

Links: Interesting blogs

Links: User Groups

Stuff I do

February 2005 - Posts

Planning for my MMS presentation

I am putting together my plans for what to discuss during my MMS presentation on Automating Windows System administration using scripting technologies. I have a ton of thoughts, but I'd like to see what the community is interested in hearing.

If you want something covered, then send me an email detailing your needs.

Thanks

Posted Tuesday, February 22, 2005 12:13 PM by dthomson | 1 comment(s)

Filed under:

Is Open Source taking over the industry?

We've all seen the articles speaking of how the open source products are taking over the industry. One instance of this is the Firefox browser. We are told that Firefox is moving rapidly and will own a large segment of the market before long. The problem I have with the reporting is that these articles are using statistics based on the number of downloads versus actual product usage. If this is how product popularity is going to be reported, then I know I've really bumped up a few sites when I downloaded a tool to work on a system, used it and then removed it when I was done. Do this quite a bit and it will really begin to skew the numbers.

I added a freeware counter from StatCounter to my blog the other day. On a limited basis, it allows me to keep track of various statistics relating to who is visiting and what is being read. Since I'm a proponent of accurate reporting, I thought I'd provide some statistics. It's only been a few days, but the numbers are interesting.

Browsers    
  Firefox 7
  Internet Explorer 69
  Opera 1
Operating Systems    
  Linux 1
  Windows 136

Clearly these statistics show that the news headlines are not correct. Of course this is the weekend, so I'll keep tabs on things this coming week and report back my findings.

Please note that this article was not posted to try to swing users to a particular product, but instead, to try to bring a bit of reality to what is being reported.

Posted Sunday, February 13, 2005 1:51 PM by dthomson | 3 comment(s)

Filed under:

Friday humor: Place the State

This was shared on the NT SysAdmin email list today. It's pretty cool. Test how accurate you are with your knowledge of locating the states.

Place the State

I scored 96% with an average error of 6 miles and it took me 506 seconds (including some time for a few distractions)

Go here -> States Web Games for more.

Posted Friday, February 11, 2005 4:34 PM by dthomson | with no comments

Filed under:

Adding a search feature to your blog

This may have been covered by someone else already, but here is my take on adding a search feature to your blog.

For blogs based on the .Text code, navigating through the Admin features of your blog, you should go to Options -> Configure and add the following code to the Static News/Announcement section.

<h3>Search</h3>
<input type="text" name="txtSearchString" id="txtSearchString" onkeypress="CheckEnter(event);" size="21"><br>
<select name="cbxSearchOption" id="cbxSearchOption" size="1">
<option selected value="+inurl:blog/dthomson+site:www.myitforum.com">My Blog</option>
<option value="+dthomson+site:www.myitforum.com">All my myITforum items</option>
<option value="+inurl:blog+site:www.myitforum.com">All myITforum blogs</option>
<option value="+site:www.myitforum.com">All myITforum</option>
<option>All the Internet</option>
</select>
<br>
<input type="button" value="Search" onclick="DoTheSearch();">
<script type="text/javascript">
function CheckEnter(event) {
 var keyCode = (event) ? event.keyCode : keyStroke.which;
 if (keyCode == 13)
  DoTheSearch();
}
 
function DoTheSearch() {
 var oInput = document.getElementById('txtSearchString');
 var strSearchCriteria = escape(oInput.value);
 var oSearchOption = document.getElementById('cbxSearchOption');
 var strSearchOption = oSearchOption.value;
 if(strSearchCriteria != "") 
  
window.open('http://www.google.com/search?q=' + strSearchCriteria + strSearchOption,'_blank',
    'height=450,width=700,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');

}
</script>

The two items in red will need to be changed to reflect the proper location of your blog (item 1) and your username on myITforum.com (item 2).

Q: What does this code do?

A: This code will add a search area to the News section of your blog. The search uses Google and includes the following items:

  • A text input area for the user to type in the search term
  • A drop down selection box for the user to select the search scope. In this example, I have populated the list to include the following options: My Blog, All my myITforum items, All myITforum, and All the Internet. These options can be customized by modifying the code section which is highlighted in green.

Another customization I did to the search was to have the results displayed in a separate window (see the code highlighted in blue).

Feel free to contact me if you have questions or comments on this post. I hope you find this useful.

Posted Friday, February 11, 2005 12:54 PM by dthomson | 1 comment(s)

Filed under:

Are you adding your custom MOF to the autorecover list?

I wonder if anyone is deploying their custom mof files and, while doing so, inclduing them in the list of mof files which are autorecovered during a rebuild of the WMI repository.

Running the following command when deploying your custom mof file will include it in the autorecover list.

MOFCOMP -AUTORECOVER moffile.mof

The autorecover list is located in the following registry entry: HKLM\Software\Microsoft\WBEM\CIMOM\Autorecover MOFs

I'd like to hear your comments on this topic. If you cannot post a comment to this post, then please send them to me via email.

Posted Tuesday, February 08, 2005 12:10 PM by dthomson | with no comments

Filed under:

Tips for sharing files

Our community has a wonderful sense of openness which allows us to not only learn from the experiences of others, but to also freely give back by sharing stuff that we do.

Here are a few tips when sharing files.

  • Share your name, email address and version number of the file. This will allow others to give credit where it's due and with the means to contact you if problems are found.
  • Include a brief section in the file or in a separate readme file describing what the file does.
  • Be sure the file does not contain any confidential information which may enlighten someone with knowledge about your enterprise. As mentioned by Mark Sarifine in his Technology Forum Safety article, leaving this information intact can put a would be attacker that much further ahead in gaining access to your enterprise systems.
  • Format and document the file. This allows the file to be that much more readable and will assist others in understanding what's happening.
  • Use environment variables as much as possible. For instance, don't reference the Program Files directory directly, but instead use the %ProgramFiles% environment variable.
  • Microsoft introduced a measured level of difficulty with their naming convention for where the operating system files are placed. The directory is named WINNT in Windows NT 4, 2000, and the server products and Windows in the Windows 9x, ME, and XP products. Using the %WinDir% or %SystemRoot% environment variables when referencing this directory will also allow the file to be more easily shared. It's no problem if the environment is all Windows XP. But it can be bad if a mixed environment exists.
  • Finding the drive on which the operating system is installed on can be tricky as well. There are many individuals who have multi boot systems or who have installed the operating system onto a drive other than drive C:. Using the %SystemDrive% environment variable will ensure that no issues arise when working in such an environment.
  • Instead of using environment variables, the file can be written so that the pertinent information is read from the registry.
  • So far we've touched base on ensuring everything works properly on a local system. What about performing operations against a remote system? Well, I'm glad you asked. When performing operations against a remote system, I suggest that the item be coded to read the path from the remote registry. A WMI query which reads the environment variables in use on the remote system can also be used to to determine the proper directory location. An example of why this is a problem is when there is a mixed OS environment and the process attempts to access a remote log file. These log files could be held in either the WINNT or Windows directory.

These bullets mainly apply when sharing script (bat, vbs, kix, etc.) and registry files.

Posted Monday, February 07, 2005 5:34 PM by dthomson | with no comments

Filed under:

TechNet Script Center Scripting Techniques

We get a wide range of questions via email and posted to the scripting forums over at www.myTIforum.com regarding how to accomplish various scripting tasks. The Scripting Guys have created a Scripting Techniques section over at the TechNet Script Center. You'll find some nice sample scripts which cover a number of topics.

Here's a list of the current categories

ADSI Sample scripts for retrieving information about objects that can be used in ADSI scripts.
Comments Sample scripts for working with comments included in VBScript scripts.
Dates and Times Sample scripts for manipulating dates and times, particularly the UTC times used by WMI.
Dialog Boxes Sample scripts for accessing Windows dialog boxes from within a script.
Dictionary Objects Sample scripts demonstrating how to create, populate, and modify arrays using the Script Runtime Dictionary object.
Displaying Output Sample scripts demonstrating alternate methods of displaying output.
Events and Monitoring Sample scripts demonstrating methods for monitoring computers.
Masking Passwords Sample scripts demonstrating methods for masking passwords.
Progress Bars Sample scripts demonstrating methods for displaying pseudo-progress bars in a script.
Retrieving Input Sample scripts demonstrating ways (such as text files and command-line arguments) to get input into a script.
Retrieving Internet Resources Sample scripts demonstrating methods of retrieving information from Web pages and RSS feeds.
Searching Active Directory Sample scripts showing techniques and queries useful in searching Active Directory.
Text Files Sample scripts for creating and for reading and writing text files using the FileSystemObject.
Web Pages and HTML Applications (HTA's) Sample scripts for both adding items (buttons, dropdown lists, text boxes, etc.) to Web pages and HTAs (HTML Applications), and for creating scripts that run in response to user interactions with those Web pages or HTAs.
WMI Sample scripts for retrieving information about objects that can be used in WMI scripts.
Working with Databases Sample scripts for connecting to and working with databases using ADO (ActiveX Database Objects).

Posted Sunday, February 06, 2005 8:14 PM by dthomson | with no comments

Filed under:

Yet another scripting resource
I don't know how many of you caught the recent 2 week long webcast series from the Scripting Guys, but Don Jones did a nice job. Were you aware that he also has his own scripting website with a bunch of sample scripts, tutorials, and books. Check it out >>> www.ScriptingAnswers.com

Posted Sunday, February 06, 2005 6:21 PM by dthomson | with no comments

Filed under:

TechNet Script Center alternate language scripts

We all know that the TechNet Script Center is loaded with sample VBScripts, but were you aware that there are also a number of sample scripts written in Perl, Python, JScript, Kixtart, and Object REXX? The Scripting Guys put together a quick FAQ in case anyone has questions on these alternate languages.

One thing I found nice while perusing the scripts listed under these other languages, is that there is a master index for each language. This master index lists the available items sorted out into various categories. I would like to see a similar index created for the VScript samples too.

Posted Sunday, February 06, 2005 6:16 PM by dthomson | with no comments

Filed under:

TechNet Script Center sample scripts for Microsoft Office

Did you know the TechNet Script Center has sample scripts for working with Microsoft Office?

Excel

Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Create User Accounts Based on Information in a Spreadsheet
Format a Range of Cells
List Active Directory Data in a Spreadsheet
List Excel Color Values
List Service Data in a Spreadsheet
Open an Excel Spreadsheet
Read an Excel Spreadsheet

Word

Add a Formatted Table to a Word Document
Add a Table to a Word Document
Add Formatted Text to a Word Document
Append Text to a Word Document
Apply a Style to a Table in a Word Document
Create a New Word Document
Create and Save a Word Document
Display Service Information in a Word Document
List Microsoft Word Properties
Modify Bookmark Text in a Word Document
Open and Print a Word Document
Read a Bookmark in a Word Document
Use Word to Search for Files

Posted Sunday, February 06, 2005 5:36 PM by dthomson | with no comments

Filed under:

Scripting Guy's webcast scripts

Following is a list of the scripts which the Scripting Guys have posted to their Scripting Guys Webcasts website. These scripts were referenced during their various webcasts.

Scripts listed in the NICs, ACKs & Network Stacks section

dhcp-renewlease.txt
dhcp-renewlease.vbs
dhcpsettings.txt
dhcpsettings.vbs
dnssettings.txt
dnssettings.vbs
getip.txt
getip.vbs
getip-multi.txt
getip-multi.vbs
getmacip-netconn.txt
getmacip-netconn-assoc.txt
getncmacip.txt
getncmacip.vbs
getncmacip-assoc.txt
getncmacip-assoc.vbs
ipsettings.txt
ipsettings.vbs
nic-acks-stacks-urls.txt
nics-acks-stacks-directorscut.zip
scripts.zip
setipcm.txt
setipcm.vbs

Scripts listed in the Documents section

adsi.zip
creating_htas.zip
database_webcast.zip
databases.zip
helpomatic.zip
ScriptingXPSP2.zip
searching_ad_scripts.zip

Posted Sunday, February 06, 2005 11:25 AM by dthomson | with no comments

Filed under:

Profile tricks

Question:

I was hoping to get pointed at a tool or something that already exists.  We have a Ghost image which puts the user's profile on the D: drive so that we can reimage the C drive with little impact to user data.  Once the box is imaged and the user logs back on it creates a new profile.  I can copy data from the old profile into the new after they log in.  I was wondering if I could import their user.dat data as well?  I haven't put a whole lot of thought into this and I would think it might be a simple process.  If you could help point me in the correct direction, that would be very helpful.

Suggested answer:

I would suggest using the USMT (User State Migration Tool). This would copy files and settings. You could do it once to capture everything, then a second time to put it all back.
 
Here are a couple of good links:
http://www.microsoft.com/downloads/details.aspx?familyid=4af2d2c9-f16c-4c52-a203-8daf944dd555&displaylang=en
 
http://www.microsoft.com/windowsxp/using/setup/expert/russel_november19.mspx

I think that will do what you are looking for.

Posted Thursday, February 03, 2005 10:01 AM by dthomson | with no comments

Patching an administrative installation

Question:

What is the good commandline to patch an administrative installation?
I have to apply the Sp3 to Access 2000 Runtime and I am not sure about the way to apply the SP to the sources.

Suggested answer:

http://support.microsoft.com/default.aspx?scid=kb;en-us;314881
 
Try using:
msiexec.exe /p {Path to MSP patch file} /a {Path to MSI to be patched}

Posted Thursday, February 03, 2005 9:57 AM by dthomson | 1 comment(s)

Pass variable from VB Script to Batch Script

Question:

I know how to do this with an integer variable, but I don't know how to do it with a string variable...
How can a batch script call a VB script, and have the VB script return the value of a string variable to the same batch script that called the VB script?
I need the necessary statements in both VBS and batch scripting.

Suggested answer:

Basically having the vbs write out a set variable=something line to another batch file and then when focus returns back to the batch, the batch will execute that file and thus set the variable.

Scenario:

Batch calls vbs
Vbs writes out set variable=something to getvariable.bat
Vbs exits
Batch calls getvariable.bat
The variable should now be available in the original batch.

Posted Thursday, February 03, 2005 9:54 AM by dthomson | with no comments

Read XML file

Question:

I remember a while back that a few scripts were posted either here or on the SMS mailing list. One nice script was posted by Richard Threlkeld. I cannot find them now. Can someone post a sample on how to read xml files from within vb script?

Much appreciated

Suggested answer:

This should also help:
 
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=252876a9.0106280634.a199733%40posting.google.com&rnum=94&prev=/groups%3Fq%3Dparse%2BXML%2BVBScript%26start%3D90%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D252876a9.0106280634.a19973
 
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ObptZWPWCHA.3476%40tkmsftngp08&rnum=122&prev=/groups%3Fq%3Dparse%2BXML%2BVBScript%26start%3D120%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3DObptZWPWCHA.3476%2540tkmsftngp08%26rnum%3D
 
You'll also find a lot of really helpful stuff in the XML SDK.

UPDATE (2/3/2005)

Richard Threlkeld sent this to me. Hope it makes life a bit easier for those working on this type of project. Thanks Richard!

Sample XML File:

<?xml version="1.0" ?>
<labinfo>
        <aa210>
                172.17.23.129
                172.17.24.193
                172.17.25.129
                172.17.26.65
                192.168.18.1
                192.168.19.1
        </aa210>
        <aa217g>
                192.168.201.1
                172.17.24.1
        </aa217g>
</labinfo>

Sample VBScript:

Option Explicit

Dim lab,xmlDoc, root, objNodeList, i, strFailure, objQNumber, Attribute

lab = "aa210"
                   
'instatiate the XML object
Set xmlDoc = CreateObject("Microsoft.XMLDOM")

'Set to synchronous loading
xmlDoc.async = False

'Load the XML datastore.
xmlDoc.load("qctlabs.xml")

Set root = xmlDoc.documentElement

        'Grab Node information
        Set objNodeList = xmlDoc.getElementsByTagName(lab)

        For i = 0 To (objNodeList.length - 1)

                If xmlDoc.parseError.errorCode <> 0 Then
                ' the parse failed - take some corrective action
                strFailure = "Error parsing file"
                WScript.Echo(strFailure)
                Else
                        objQNumber = objNodeList.Item(i).text
                        WScript.Echo(objQNumber)
                End IF
        Next
WScript.Quit

Posted Wednesday, February 02, 2005 8:26 PM by dthomson | with no comments

More Posts Next page »