In This Issue
- Perspectives: Winter Forward, Fall Back
- Let the Games Begin
- What's Your Favorite Utility?
- Coming in February
- January's Articles Now Available in PDF Format
Perspectives: Winter Forward, Fall Back
You're probably familiar with the "spring forward, fall back" mnemonic expression to remember the seasons in which you lose and gain an hour of sleep because of daylight saving time. Well, this memory trick no longer works. Beginning this year, daylight saving time is being extended by about four weeks in the United States and Canada, which means the expression would have to be "winter forward, fall back." Somehow, this expression just doesn't do the trick.
As Jim Turner reports in "Daylight Saving Time Is Changing in 2007," starting this year daylight saving time will begin earlier than it has before. It will start on the second Sunday of March (March 11 in 2007) and end on the first Sunday of November (November 4 in 2007). In anticipation of this daylight saving time extension, Microsoft has provided a time zone update for Windows Server 2003 and Windows XP. This update also includes a few other daylight saving time changes in other parts of the world. You can download the time zone update from the Microsoft article "2007 time zone update for Microsoft Windows operating systems." Alternatively, you can edit the registry in Windows 2003 and XP machines, following the instructions provided in the Microsoft article "How to configure daylight saving time for the United States in 2007."
"To the best of my knowledge, this Microsoft update is still considered optional," reports Jim. "I suppose it's possible that Microsoft has embedded some other internal method that will adjust our computer clocks via a previous update. However, I suspect not. Unless Microsoft has (or will) include it somewhere else in its auto updates or patches, come March 11, our computer clocks won't be adjusted if this update isn't applied."
In response to the upcoming changes to daylight saving time, Jim and another Scripting Pro VIP author, Chang Lu, have written scripts that might make your job updating your machines easier:
DST_Test.vbs. The Microsoft update changes the WIN32_TimeZone component. So, Jim has written the DST_Test.vbs script to test whether the WIN32_TimeZone component has been updated on Windows 2003 and XP machines. You can download this script by clicking here. To use DST_Test.vbs, simply place it on the Windows 2003 or XP machine you want to test and double-click it. You'll receive a message box that states whether or not your machine has been updated.
DST_Test.vbs uses the DLS function, which Jim uses in GetDLSDates.vbs and SuperTuesday.hta. GetDLSDates.vbs tells you the dates on which daylight saving time starts and ends in the current year. SuperTuesday.hta is a HTML Application (HTA) that displays the second Tuesday (aka Super Tuesday) of a given month for up to 72 months to get a heads-up on when Microsoft releases its patches. This HTA isn't limited to finding Super Tuesdays. You can use the HTA to get a heads-up on any day of the week of any month. You can download GetDLSDates.vbs from "Don't Let Daylight Saving Time Sneak Up on You" and SuperTuesday.hta from "Plan Ahead for Patch Tuesday.". Note that the Microsoft update just described is needed for GetDLSDates.vbs to work.
SetDSTDates.vbs. Chang has written the SetDSTDates.vbs script to automate the daylight saving time changes in Active Directory (AD) environments. Unlike the Microsoft update, this script applies the daylight saving time changes to Windows 2000 machines as well as Windows 2003 and XP machines. Specifically, you can use the script on the following platforms:
- Windows Server 2003 x64 Editions
- Windows Server 2003
- Windows XP 64-Bit Edition
- Windows XP
- Windows 2000 Server
- Windows 2000 Professional
Chang has written a silent mode version of SetDSTDates.vbs, which is named SetDSTDates_Silent.vbs. In addition, he's written two self-executables so that you can easily execute SetDSTDates.vbs and SetDSTDates_Silent.vbs. Starting on February 14, these scripts and executables will be available in the article "Script Improves Upon Microsoft's Daylight Saving Time Patch" on the Scripting Pro VIP Web site.
—Karen Bemowski, Scripting Pro VIP Editor
Let the Games Begin
For the second year, Microsoft is holding its Scripting Games competition, which will run from February 12-23. There are 10 games designed for novice VBScript or PowerShell scripters. The novice-level games include "Hopscotch," "Dress-Up," "Jacks," and "Mother May I?" Similarly, there are 10 games designed for experienced VBScript or PowerShell scripters. The advanced-level games include "Pick a Color, Any Color," "20 Questions," "Get Me the Operator, Please," and "Can You Keep a Secret?" If you're ready to flex your scripting muscle or if you just want to find out what's involved in these strange-sounding contests, check out the 2007 Scripting Games at the Microsoft Script Center.
What's Your Favorite Utility?
In a recent edition of Scripting Central (a free email newsletter), we published the results of a contest in which readers told us about the free utilities they often use in their scripting endeavors. I want to share that list with you in case you don't subscribe to Scripting Central. More important, I want to build on the list that was compiled. So, if your favorite scripting utility isn't on the list below, please email me about that utility. Note that the utility must be free and not a Microsoft tool. (Most people are already familiar with the Microsoft utilities.) I'll add your utility to the list, which you can access at any time by going to the Scripting Pro VIP Web site and clicking the Scripters' Favorite Free Utilities link under the RELATED LINKS heading on the lower left.
Here are the utilities that your fellow scripters are using and recommending. (For readers' specific comments about the utilities, check out "Readers' Favorite Utilities.") For quick reference, I've broken the utilities into categories:Editors
- Notepad++: Notepad++ is a simple but useful editor that supports a wide variety of scripting and programming languages, including VBScript, KiXtart, Perl, XML, HTML, Active Server Pages (ASP), and Visual Basic (VB). It offers features such as syntax highlighting and auto-completion.
- PSPad: PSPad is an editor that supports many scripting and programming languages, including VBScript, JScript, Perl, HTML, MySQL, PHP, and Pascal. The features include syntax highlighting, code templates, a macro recorder, a full hex editor, a spell-checker, and the ability to handle plaintext.
- SciTE: SciTE is an editor that's part of AutoIT v3. (See the "Scripting Languages/Environments" category for more information about AutoIT). However, you can download SciTE separately. SciTE works with the AutoIt v3 language and other scripting languages. In addition to syntax highlighting, SciTE offers auto-completion and auto-indentation.
- Vim: Vim is an improved version of the VI editor distributed with most UNIX systems, but Vim also offers a GUI for people who like menus and clicking. The Web site states that Vim is an advanced editor that isn't "designed to hold its users' hands." However, it's well suited for cross-platform environments. This editor supports many scripting and programming languages and is customizable. Its features include vertical split windows, flexible indenting, and support for Unicode editing.
- Blat: Blat is a Win32 command-line utility that uses SMTP to send email and Network News Transfer Protocol (NNTP) to post to Usenet.
- CodeKeep Add-In: CodeKeep is an online repository of code snippets written in a variety of scripting and programming languages, including VBScript, HTML, and Visual Basic .NET. This Web site offers a free utility—the CodeKeep Add-In for Visual Studio (VS)—that is a code snippet manager.
- WinZip Command Line Support Add-On:WinZip offers a free WinZip Command Line Support Add-On that lets you use WinZip directly from the command line and from batch files and other types of scripts.
- Regular Expression Laboratory: The Regular Expression Laboratory lets you create regular expressions, then test those expressions by applying them to arbitrary text.
- AutoIt v3: AutoIt v3 is a standalone (no external DLL files or registry entries required) scripting language for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movements, and window/control manipulation to automate tasks. The latest version includes the new AutoIt v3 language, which the developer says has a more standard syntax (similar to VBScript and BASIC) than the previous version. Plus, the AutoIt v3 language supports complex expressions, user functions, looping, and other advanced features.
- Python: Although Python is a dynamic object-oriented programming language, you can use it to develop scripts. One scripter who is a DBA says, "I can develop scripts quickly and easily, and given the nature of Python code to be easily readable, I can understand my own code months after it was written. (This is not always a given!)"
- DumpSec: DumpSec is a Windows security auditing program that you can use to produce reports on NTFS permissions for file systems, printers, shared folders, and even registry hives. It can also provide information about groups, users, rights, policies, and services.
- MD5WIN: Message-Digest algorithm 5 (MD5) provides a way to verify data integrity. MD5WIN is a graphical-mode Windows program for computing and comparing MD5 digest strings for files and text strings.
- Joeware: Among the tools you'll find on the Joeware site are AdFind, AdMod, and ExchMbx. You can use AdFind and AdMod to query and modify Active Directory (AD). ExchMbx is command-line tool for working with Microsoft Exchange mailboxes.
- NirSoft: Among the tools you'll find on the NirSoft Web site are MessenPass and NirCmd. MessenPass is a password recovery tool that reveals the passwords of IM applications. NirCmd is a command-line utility that lets you perform different types of tasks (e.g., write and delete registry values and keys, open the door of a CD-ROM drive) without going through a UI.
Coming in February"Create Excel Reports the VBScript Way, Part 1" by Jim Turner
Last month, Jim Turner introduced readers to the basics of scripting Microsoft Excel reports in his article “eXLerate Your Scripts." This month, he starts a five-part series that gives you a detailed tour of how to use VBScript scripts to produce Excel reports. In "Create Excel Reports the VBScript Way, Part 1," Jim introduces an HTA that contains reusable Excel-related code snippets and functional demonstrations of how those code snippets work.
This article is now live on the Web.
Beginning this year, daylight saving time is being extended by about four weeks in the United States and Canada. The SetDSTDates.vbs script updates daylight saving time in AD environments. Unlike the Microsoft update, this applies the daylight saving time changes to Win2K machines as well as Windows 2003 and XP machines.
Coming February 14
When you develop Microsoft SQL Server solutions, you might need to create SQL Server Integration Services (SSIS) packages to retrieve the data you need. In most cases, SSIS packages contain at least one Data Flow task that extracts, transforms, and loads data into the target destination. For each Data Flow task, you must include the components necessary to carry out the data flow operations. However, sometimes the built-in data flow components can’t perform a specific task. In "Scripting Data Flow in SQL Server Integration Services," you'll learn how to use the Script component to create a custom script that extends your SSIS package.
Coming February 21
If you often include code to delete files in your scripts, you'll probably be interested in the CleanUpOldFiles subroutine. You can drop this subroutine into scripts to delete files based on their age.
Coming February 28
Here's a VBScript function named fetchSQL that queries Microsoft SQL Server databases for data, then returns that data in an array. In a script, you can call the fetchSQL function, then use VBScript's IsArray function to test whether any records are returned.
Coming February 28
January's Articles Now Available in PDF Format
For easy reading and printing, we've compiled all the January Scripting Pro VIP articles in a single .pdf file. You can download this .pdf file, along with all the code for those articles, by clicking here. To recap, here are the articles that were featured in January:
- "eXLerate Your Scripts" by Jim Turner
- "Scripting Control Flow in SQL Server Integration Services" by Robert Sheldon
- "Understanding PowerShell Security" by Alex K. Angelopoulos
- Reader to Reader: "Automatically Delete Old Files" by James Lim
- Reader to Reader: "Dsquery" by Michael Bailey