Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


June 1998

Bob's XLNT Adventure


RSS
Subscribe to Windows IT Pro | See More Systems Administration Articles Here | Reprints

Download the Code Here
Download the Code Here
Download the Code Here

Too bad Ted wasn't around to learn about this software's Windows NT command and scripting environment

At Windows NT Magazine's Professionals Conference 98 in Orlando, Florida, I learned about an interesting Windows NT command and scripting environment. Advanced Systems Concepts, Inc. (ASCI) has developed eXtended Language for Windows NT (XLNT) 1.1, which consists of three components: a shell or command processor, a collection of XLNT-based commands, and a scripting language.

XLNT is similar to the popular UNIX-like toolkits for NT, except that XLNT's roots are in Digital Equipment's OpenVMS. As a result, XLNT's command syntax and scripting language look and feel like Digital Command Language (DCL). XLNT supports NT 3.51 or later and Windows 95.

What I find most interesting about the software is its collection of commands. I'm not talking about simple ports of useful VMS commands, but full-featured utilities that outperform many of NT's built-in and resource kit utilities. For example, XLNT's SECURITY command provides almost every option available in User Manager for Domains. This option-packed command and XLNT's robust scripting language make this software a potentially powerful NT automation environment. Let's take a closer look at XLNT's SECURITY command and how you can use it in an XLNT script.

Understanding the SECURITY Command
You use the SECURITY command to control and maintain NT users, groups, and policies. The command supports four modes of operation: CREATE, DELETE, MODIFY, and SHOW. The SECURITY command accepts additional arguments, or qualifiers, based on the mode in which you use the command. Table 1, page 216, lists the SECURITY command's modes and associated qualifiers.

The SECURITY command provides a rich set of user management capabilities. For example, with one command, you can create a user account, set its properties, and specify all the groups the user is to be a member of with the /GLOBAL and /LOCAL qualifiers. You can also use the /RIGHTS qualifier to specify any special user rights the account needs. The SECURITY command supports remote domains with the /DOMAIN[=domain-name] switch, a feature missing from NT's NET USER command.

Screen 1, page 216, shows an XLNT session that I invoked with the SECURITY CREATE USER command. I executed this XLNT command from the XLNT shell, or console, which XLNT refers to as local interactive mode. You can also use two other methods: a Telnet-like facility that supports remote console interaction or NT's native command processor, cmd.exe, to invoke an XLNT command. To invoke a command, you preface it with XLNT. For example, typing the SECURITY CREATE USER command

c:\> xlnt security create user ...

at the NT command prompt invokes the XLNT command processor and gives the processor the SECURITY CREATE USER command. The directory containing the xlnt.exe command processor (C:\asci\xlnt, by default) must be in your path environment variable.

If you dissect the SECURITY CREATE USER command in Screen 1, you will see how XLNT works. XLNT creates a global user account, "tmtowtdi," in the LAB domain and configures standard user account properties (e.g., full name, description of the user, password, home directory, user profile path, and logon script name). XLNT uses the /PASSWORD_ EXPIRES qualifier to set the User Must Change Password at Next Logon flag. Next, XLNT explicitly grants the user account the right to back up files and directories. Finally, XLNT adds the account to the Users and Administrators local groups and to the Domain Admins global group. (These groups are in addition to the default global group, Domain Users.)

In the command in Screen 1, many strings are in quotes. By default, XLNT converts all strings to uppercase. To inhibit this behavior, you must enclose strings in quotes. For example, if you don't put quotes around zpx1ba in the /PASSWORD= qualifier, XLNT would assign ZPX1BA as the user's password.

Screen 2 shows the results (including the updated User Rights Policy) of executing the SECURITY CREATE USER command in Screen 1. Although effective, this command has one limitation. The /HOME_DIRECTORY= qualifier doesn't let you specify drive letters for server-based home directories. In all my tests, the qualifier automatically assigned Z as the drive letter. ASCI states that it will correct this problem in version 2.0, which the company plans to release mid-1998.

Using the Command in an XLNT Script
Now that you understand the SECURITY command's capabilities, let's look at how you can use it in an XLNT script. Listing 1 contains addusers.xcp, a simple XLNT script that creates NT user accounts in batch mode based on the comma-delimited input file, users.txt, in Listing 2. Addusers.xcp is an adaptation of a similar script available on ASCI's Web site (http://www.advsyscon.com). You can find several sample administration scripts and utilities in ASCI's online software library.

Before you use the SECURITY command in an XLNT script, you need to know a few script basics. XLNT scripts (ASCI refers to these scripts as command procedures) are a collection of XLNT statements, commands, and functions that you group and submit interactively or in batch. You can create XLNT scripts with your favorite text editor and save them with an .xcp extension. You must begin each line in a script with a dollar sign character ($). You preface any comments with the exclamation character (!), as the first line of the script in Listing 1 shows. To submit or run a script, you preface the script name with the @ character at the XLNT prompt. For example, to run addusers.xcp, you would type

$ @addusers.xcp

Now let's examine addusers.xcp. This script begins by using XLNT's OPEN command to open the users.txt file. The OPEN command requires at least two qualifiers: the file-symbol and the filename. By default, XLNT opens files with read-only permission. If the OPEN function succeeds, XLNT returns a handle to the file in the file-symbol; in Listing 1, the file-symbol is inputfile.

The script contains a primary outer loop at callout A in Listing 1. In this loop, XLNT reads a line from the input file, extracts the user data, creates the user account, adds the account to the groups defined in the input file, and then begins again.

The READ command fetches a line from the input file. Like the OPEN command, the READ command requires at least two qualifiers. The first qualifier is the file-symbol previously obtained with the OPEN command (i.e., inputfile). The second qualifier is the symbol-name that XLNT will associate with the data that it reads; in Listing 1, this symbol-name is line. The READ command fetches a line at a time by default. The READ command in this script also contains the /end_of_file=END qualifier. When the READ command reaches the end of file (EOF) marker in the file, this qualifier instructs the READ command to go to the END: label.

The code at B uses XLNT's F$ELEMENT lexical command five times to extract the individual data fields from the line read from the users.txt input file. Lexical commands are functions that return values. The F$ELEMENT lexical command requires three qualifiers: the element number to retrieve, the character used as the delimiter, and the source string. If successful, this command returns the specified element as a string.

The SECURITY CREATE USER command uses the variables, or symbols, that store the individual data fields. Notice that two apostrophes precede the quoted symbols, but a single apostrophe follows the quoted symbols. This setup forces symbol substitution within the quoted character strings.

The code at C forms the inner loop. In this loop, the script adds newly created users to the groups obtained from the users.txt input file. (The script extracted this field in the last line of the code at B and stored the information in the symbol groups. As Listing 2 shows, the users.txt input file includes multiple groups, separated by vertical bars.)

Before entering the inner loop, the script sets a control symbol, x, to 0. The script then uses x and the F$ELEMENT lexical command to extract a group and assign it to the symbol tmpgrp. If the F$ELEMENT lexical command returns something other than a vertical bar, the script invokes the SECURITY command again, but this time it uses MODIFY mode with the entity-type GROUP and the values that tmpgrp and user represent. The script repeats the process for any additional groups. When no more groups exist, the inner loop ends and the script proceeds to the next line in the input file. This cycle continues until the READ command encounters the EOF marker, which tells the READ command to go to the END: label, close inputfile, and exit.

In addition to the commands discussed in this example, XLNT includes commands to manage file systems, access control lists (ACLs), shares, scheduler, and services. XLNT's SHOW command provides a wide variety of system information, such as devices, memory, processes, and sessions. XLNT also has additional lexical commands that provide access to the NT Registry and event logs.

Getting XLNT Might Make Sense
If you have DCL experience and you're migrating from VMS to NT or integrating NT into a VMS environment, choosing XLNT is a no brainer. If you're looking for a way to extend NT's command line with a powerful set of utilities and a scripting language to boot, XLNT might be worth a look. Version 2.0 will include support for Windows Scripting Host (WSH), an integrated development environment, and native URL support. You can download an evaluation copy of XLNT 1.1 from ASCI's Web site. An evaluation copy of XLNT 2.0 will also be available when ASCI releases this version.

End of Article



Reader Comments
I enjoyed reading the June Scripting Solutions article, “Bob’s XLNT Adventure.” In your article, you refer to “popular UNIX-like toolkits for NT.” I’m a UNIX veteran learning NT. Can you tell me what these toolkits are, which toolkit is the most popular, and why you think XLNT is preferable? Thanks!<br>
--Barry Brooks<br><br>

<i>AEleen Frisch’s book,</i> Essential Windows NT System Administration <i>(O’Reilly & Associates), is a good source for information about UNIX toolkits. (For a review of this book, see page 190.) The most popular UNIX toolkit is MKS Toolkit 6.1 from Mortice Kern Systems (http://www.mks.com). A recent press release (http://www.mks.com/
press/980506a.htm) stated that Microsoft will license a subset of utilities from MKS for inclusion in Microsoft’s forthcoming Windows NT Services for UNIX Add-On Pack.
Picking which toolkit to use depends on your background and skill set. XLNT’s greatest strength is that its commands are robust and comprehensive. However, if you’re not familiar with Digital Command Language (DCL), you’ll have a bit of a learning curve with the product. MKS offers a more general UNIX tool set, but its utilities aren’t as robust as XLNT’s. You need to decide what’s most important to you. Both products include an ActiveX implementation of their respective languages—that is, they plug into Microsoft’s Windows Scripting Host (WSH) architecture.<br>
--Bob Wells</i>

Barry Brooks August 11, 1999


Since reading Bob Wells’ Scripting Solutions: “Bob’s XLNT Adventure” (June), about Advanced Systems Concepts’ XLNT scripting language software, I’ve searched for the product without success. Can you supply the URL for the company?<br>
--Dag Thuland<br><br>

<i>The URL is http://www.advsyscon.com. The Windows NT Magazine Lab reviews the product in this issue of the magazine (see “XLNT 2.0,” page 106).<br>
--Bob Wells</i>

Dag Thuland August 11, 1999


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...

Managing Virtual Sprawl

As some wise person once said, nothing is ever truly free. Such is the case with VMs, which can quickly mutate from a cost-reducing Dr. Jekyll into a time-consuming, profligate nightmare that would do Mr. Hyde proud. ...

The website is down because someone removed the X-Box

What happens when a manager mistakes a server for a games console. ...


Task Automation Whitepapers One Less Fire: Automating System Performance and Reliability

Maximizing Site Visitor Trust Using Extended Validation SSL

St. Bernard Managed Protection Services

Related Events Virtualization Congress

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Order Windows IT Pro VIP and SAVE!!
Get it all with Windows IT Pro VIP A $500+ value foir only $279!

Monthly Online Pass - Only $5.95!
Get instant access to 9,000+ articles from Windows IT Pro Magazine!!

Buy One Get One!
Order Windows IT Pro & Get SQL Server Magazine FREE!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.




ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

EXCHANGE 2007 Mastery Series – May 29, 2008
3 Info-packed eLearning seminars for only $99! Learn the pros and cons of your mailbox high availability options, see real-world examples of Transport Rules, and get started with basic PowerShell commands with Mark Arnold, MCSE+M and Microsoft MVP.

Windows IT Pro Master CD: Take the Experts with You!
Find the solutions you need in thousands of searchable articles, helpful bonus content, and loads of expert advice with the Windows IT Pro Master CD. Order comes with a 1-year subscription to the new, online articles posted every day!

Making the Case for Oracle Database on Windows
One of the best-kept secrets in the IT industry is the depth of support Oracle offers to customers deploying its databases on Microsoft Windows platforms.

SQL Server Magazine Master CD: Take the Experts with You!
Find the solutions you need in thousands of searchable articles, helpful bonus content, and loads of expert advice with the SQL Server Magazine Master CD. Order comes with a 1-year subscription to the new, online articles posted every day!

Attention User Group Leaders...
Announcing the eNews Generator—a FREE HTML e-newsletter builder for user group leaders. Build your HTML and text e-newsletters in minutes. And add Windows IT Pro & SQL Server Mag articles alongside your own message!.

Become a fan of Windows IT Pro on Facebook
Join the Windows IT Pro fan club on Facebook. Chat with other IT Pros, upload your pictures, check out what's up n' coming in the next issue and more!



Solve the 12 Toughest Active Directory Management Tasks Today
No matter which management tasks you’re dealing with, you’ll discover a new set of ideas about how to best manage your Active Directory environment.

Get Started with Oracle on Windows DVD
Learn how Oracle gives you the power to grow by providing a scalable, easy-to-use platform for running your business at a price you can afford.

Exchange and Outlook Update Fundamentals CD
Gain an introduction to Exchange, learn server security requirements, and understand how unified communications can play a role in your messaging strategies with this free Exchange CD.

Virtualization Essentials – Free Online Conference :: June 24th
Learn virtualization basics - Discover how to reduce IT costs while increasing the efficiency, utilization, and flexibility of your existing computer hardware. Register Today!

Gain enhanced insight into and control over your IT systems.
View this web seminar to learn about the latest and greatest features and product enhancements in the Systems Center Configuration Manager SP1 and R2.

11 Myths About Microsoft Exchange Backup & Recovery
This white paper will guide you in overcoming Exchange Backup and Recovery myths with careful planning and the right toolset.
Windows IT Pro Home Register About Us Affiliates / Licensing Press Room Media Kit Contact Us/Customer Service  
SQL Connected Home IT Library SuperSite FAQ Wininfo News
Europe Edition Office & SharePoint Pro Windows Dev Pro Windows Excavator 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing