Scripting Central--Is It Your Turn to Take a Bow?--May 5, 2006

Downloads
50174.zip

1. Perspectives

  • Is It Your Turn to Take a Bow?
  • 2. This & That

  • Monad Gets a Real Name
  • 3. Script Watch

  • Protect Your IGDs Against Hacker and Spyware Attacks
  • 4. Scripter's Toolkit

  • Short Shell Script Supplies Diruse.exe Arguments
  • 5. Featured White Paper

  • Do You Need 100% Uptime For Your Mission-Critical Email?
  • 6. Announcements

  • Windows IT Pro Master CD--SAVE 50%!
  • May Exclusive--Save $100 off the Exchange & Outlook Newsletter
  • 7. Events and Resources

  • The Essential Guide to Infrastructure Consolidation
  • Configuring and Managing a Virtual Lab for the Enterprise
  • Email Compliance Requirements: Getting Started
  • Expect the Unexpected: Disaster Recovery
  • Maximize the Potential of Your Windows Environment

  • 1. Perspectives
    by Karen Bemowski, [email protected]

    Is It Your Turn to Take a Bow?
    Anne Grubb and I are on a mission. Scripting is taking center stage in the August issue of Windows IT Pro. We need to find a super scripter--an IT Pro Hero in the scripting world--that we can put in the spotlight.

    You don't need to have superhero powers like Superman or the Bionic Women to be an IT Pro Hero. And you don't need to have a corner office with a bird's eye view. We're looking for a regular Joe or Joanna whose scripting skills saved the day by solving a serious problem, saving a lot of money, or automating a very time-consuming task.

    If you fit this bill, don't be shy and tell us your story. Tell us about the situation you faced, how your script remedied that situation, and the results of using that script. For good examples of the type of story we're looking for, check out "Crouching Server, Hidden Memory Leak" (http://www.windowsitpro.com/Articles/ArticleID/47770/47770.html) and "Scripts Save Small Company Some Considerable Cash" (http://www.windowsitpro.com/Windows/Article/ArticleID/46968/46968.html). You don't need to be a Windows IT Pro subscriber to view these articles.

    As the examples show, your story doesn't need to be that long--only about 800 to 1000 words. When you send us your story, please include the code file. Although we won't publish the script in the magazine, we'll include a link to it so that readers can download it. That way, if readers find themselves in a similar situation, they can check out your script and possibly adapt it for use in their environment.

    Please send your stories to me at [email protected] or Anne Grubb, Windows IT Pro senior editor, at [email protected] We need to have your story by June 1. If your story is chosen, you'll not only get to be in the spotlight but also get $200 and a copy of the issue in which your story appears.

    Speaking of being in the spotlight, I'd like to thank Joshua Arzt, David Gray, James Troy, Tad Sherrill, and Bill McEvoy for responding to last month's column and sending me their scripts and code snippets. You're scripting heroes in my book!

    2. This & That

    Monad Gets a Real Name
    Unless you have been working way too hard or have taken a hiatus from scripting the past couple of years, you've probably heard of Monad. Monad has been the code name for a command-line shell and task-based scripting technology. Earlier this week, Microsoft finally announced an official name for this technology: Windows PowerShell. For more information about Windows PowerShell and links to related Web pages, go to http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx.

    3. Script Watch

    Protect Your IGDs Against Hacker and Spyware Attacks
    Many broadband routers, cable modems, and other Internet Gateway Devices (IGDs) are Universal Plug and Play (UPnP) enabled so that you can remotely manage them. However, UPnP can pose a security risk. Dave Roth tells you about this risk and how you can mitigate it with a Perl script in the article "Query IGD Port Maps." Look for this article in the June issue of Windows Scripting Solutions.

    4. Scripter's Toolkit

    Editor's note: Bill Stewart is the third and final winner of the "Mighty Mini" contest. His script supplies default command-line arguments for the Diruse.exe utility. Bill also won the drawing for the extra $100.

    Short Shell Script Supplies Diruse.exe Arguments

    Diruse.exe is a handy command-line tool when you want to quickly see how much disk space a directory is using. To use it, you type the Diruse command, its options, and one or more directory names. I found myself frequently typing the command

       Diruse /, .
    

    The /, option tells Diruse to use thousands separators when displaying directory sizes. The period (.) tells Diruse to get the current directory's size.

    Because I was typing this command fairly frequently, I created a command- shell script that initializes the Diruse command with the /, option and the current directory as defaults. The script also expands the period to the full name of the current directory. That way, the full directory name appears in the Diruse output. This script even uses a shorter command name--"du" instead of "diruse"--to boot.

    Here's my DU.cmd script:

       @Echo Off
       If Not \{%1\}

    \{/?\} Goto :START Echo Runs Diruse with default command-line options. Echo. Echo DU \[options\] \[path \[...\]\] Echo. Echo Uses the Diruse utility to display the size of one or more Echo directories. Echo. Echo \[options\] are for the Diruse command; use the command "Diruse /?" Echo for help with its options. Echo. Echo The current directory is assumed if none is specified. Goto :EOF :START Setlocal Enableextensions Set ARGS=/, Set DIRS= If \{%1\} NEQ \{\} Goto :ARGS :CURRDIR Set DIRS="%CD%" Goto :EXEC :ARGS Set ARG=%~1 If "%ARG:~0,1%"

    "/" (Set ARGS=%ARGS% "%ARG%" & Shift) Else (Goto :DIRS) If \{%1\}

    \{\} Goto :CURRDIR Goto :ARGS :DIRS If \{%1\}

    \{\} Goto :EXEC If Exist "%~1\" (Set DIRS=%DIRS% "%~f1") Else (Echo %~1 not found) Shift Goto :DIRS :EXEC If Defined DIRS Diruse %ARGS% %DIRS% Endlocal

    To change the default options for the Diruse command, modify the Set ARGS= line under the :START label in the script. For example, if you want to use both the /* and /, options, use this line:

       Set ARGS=/* /,
    

    The script's logic and flow should be fairly easy to follow. You can download a commented version of DU.cmd by going to http://www.windowsitpro.com/Windows/Article/ArticleID/50174/50174.html and clicking the 50174.zip hotlink.) The script uses Diruse.exe from the Windows XP Service Pack 2 Support Tools (http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126- 9761-BA8011FABF38).

    When you launch DU.cmd, you don't need to specify a directory name or even a period if you want the size of the current directory. Alternatively, you can specify multiple directory names on the command line. If any of the directory names contain spaces, enclose them in quotes. (DU.cmd handles quotes automatically.) I've found this script to be a very useful addition to my scripting toolkit.

    5. Featured White Paper

    Do You Need 100% Uptime For Your Mission-Critical Email?
    Learn how to address challenges such as making email truly available 24x7x365, securing against viruses, comprehensively backing up email data, and more.
    http://www.windowsitpro.com/go/whitepapers/123together/emailhighavailability?code=0503featwp

    6. Announcements

    Windows IT Pro Master CD--SAVE 50%!
    Subscribe today and get portable, high-speed access to the entire Windows IT Pro article database on CD: a searchable library that includes every Windows IT Pro issue ever published. The newest issue also includes BONUS Windows IT Tips. Order now and save:
    https://store.pentontech.com/index.cfm?s=9&promocode=eu2265uc

    May Exclusive--Save $100 off the Exchange & Outlook Newsletter
    For a limited time, order the Exchange & Outlook Administrator newsletter and SAVE up to $100! You'll get 12 helpful issues loaded with solutions you won't find anywhere else and FREE access to the entire Exchange & Outlook online article database. Subscribe now:
    https://store.pentontech.com/index.cfm?s=1&promocode=eu2365ue

    7. Events and Resources

    The Essential Guide to Infrastructure Consolidation
    Learn the essentials about how consolidation and selected technology updates build an infrastructure that can handle change effectively.
    http://www.windowsitpro.com/go/essential/hp/infrastructure/?code=0503emailannc

    Configuring and Managing a Virtual Lab for the Enterprise
    Use virtual server technology to consolidate your production environment using only a fraction of the server hardware in the data center. Live Event: Thursday, May 18
    http://www.windowsitpro.com/go/seminars/surgient/virtuallab/?partnerref=0503emailannc

    Email Compliance Requirements: Getting Started
    Design effective policies to protect your company's assets and data. Don't accidentally damage what you mean to protect! View this on-demand seminar today.
    http://www.windowsitpro.com/go/seminars/compliance/?partnerref=0503emailannc

    Expect the Unexpected: Disaster Recovery
    Learn to differentiate alternative solutions to disaster recovery for your Windows-based applications to determine what works for you and ensure seamless recovery of your key systems--whether a disaster strikes just one server or the whole site. Live event: Thursday, May 11
    http://livemeeting.viewcentral.com/reg/Neverfail/WindowsITPro

    Maximize the Potential of Your Windows Environment
    Increase administration efficiency, build flexible yet inexpensive file-server environments, and maximize potential through consolidation of your SQL Server environment. Make the most of your resources today!
    http://www.windowsitpro.com/go/toolkit/polyserve/?code=0503emailannc

    Contact Us

  • About Scripting Central -- [email protected]
  • About product news -- [email protected]
  • About your subscription -- [email protected]
  • This email newsletter is brought to you by Windows IT Pro, the leading publication for IT professionals deploying Windows and related technologies. Subscribe today!
    https://store.pentontech.com/index.cfm?s=1&promocode=eu205xfb

    View the Windows IT Pro Privacy Policy.
    http://www.winnetmag.com/aboutus/index.cfm?action=privacy

    Windows IT Pro is a division of Penton Media, Inc. 221 East 29th Street, Loveland, CO 80538, Attention: Customer Service Department

    Copyright 2006, Penton Media, Inc. All Rights Reserved.

    Hide comments

    Comments

    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.
    Publish