Win32 Perl Scripting: The Administrator's Handbook

Overview

Scripting has become an enormously popular method of managing and maintaining Windows NT and 2000 networks—as evidenced by the success of Windows NT Shell Scripting, which has sold over 30,000 copies in 2 years. Simpler than programming, yet allowing greater complexity and utility than packaged network management tools, scripting is now the tool of choice by many of you network administrators. Perl is yet another powerful element of the scripting arsenal, yet since it has been ported to the Windows environment, ...

See more details below
Other sellers (Paperback)
  • All (20) from $1.99   
  • New (5) from $29.21   
  • Used (15) from $1.99   
Sending request ...

Overview

Scripting has become an enormously popular method of managing and maintaining Windows NT and 2000 networks—as evidenced by the success of Windows NT Shell Scripting, which has sold over 30,000 copies in 2 years. Simpler than programming, yet allowing greater complexity and utility than packaged network management tools, scripting is now the tool of choice by many of you network administrators. Perl is yet another powerful element of the scripting arsenal, yet since it has been ported to the Windows environment, very little information has been published on how to employ this extremely effective tool. Win32 Perl is so powerful that it can accomplish virtually any task that you may want to perform. Dave Roth, prolific creator of Win32 extensions, is prepared to share his unique insight into how these tasks can be accomplished and provide scripts that can be immediately employed. This book illustrates how Perl can automate many current mundane administrative tasks.

Read More Show Less

Editorial Reviews

From Barnes & Noble
Our Review
Windows system administrators: The more comfortable you get with scripting, the less time you'll waste on brainless stuff -- and the more time you'll have for more challenging pursuits. That's why you want Dave Roth's Win32 Perl Scripting: The Administrator's Handbook.

Roth actually wrote several key Win32 Perl extensions, including Win32::ODBC, and he's managed Windows-based WANs encompassing thousands of users. He knows the kinds of problems Windows sysadmins encounter, and he presents dozens of practical Perl scripts and techniques for automating them.

For example, there's the old standby: adding large numbers of users at once. (Don't tell us you're still adding users one at a time!) Or, how about backing up and restoring network shares, user accounts, machine accounts, and permissions? Or scanning event logs for errors. Or discovering hidden shares on remote machines. Or renaming an individual user account. Or locating errant text strings in the Registry. Or forcing a full domain synchronization. Or identifying all the files a suspicious user account currently has open. Or automating the setup of new PCs.

If you've done any of these things (or thought about doing them), you can do them faster next time with Roth's scripts. Why wouldn't you want to?

From The Critics
The computer program scripting language Perl is described here for those network administrators working with Windows. Rather than teaching how to run a Win32 network, this book teaches techniques for streamlining tasks. The text covers account maintenance, tools, crisis management, monitoring, reporting, logon scripts, processes, Win32 services, and ADSI and WMI. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9781578702152
  • Publisher: Sams
  • Publication date: 10/31/2000
  • Series: Circle Series
  • Edition number: 1
  • Pages: 371
  • Sales rank: 998,907
  • Product dimensions: 6.00 (w) x 8.90 (h) x 0.90 (d)

Meet the Author

Dave Roth is the contributor of various popular Win32 Perl extensions, including Win32::ODBC, Win32::AdminMisc, Win32::Daemon, and Win32::Perms. He has been providing solutions to the Perl community for difficult-to-solve problems since 1994. Dave has been a speaker at the O'Reilly Perl Conferences as well as the USENIX LISA-NT conferences. He has also contributed to the Perl Journal and is the author of Win32 Perl Programming: The Standard Extensions (New Riders Publishing, 1999).

Dave has been programming since 1981 in various languages, from assembler to C++, LPC, and Perl. His code is used by organizations such as Microsoft, the U.S Department of Defense, Disney, Lucus Films, Digital Paper, Hewlett-Packard, Metagenix, Radcom, the state of Michigan, and various colleges and universities, among many others. Dave helped assemble and administer a statewide WAN for the state of Michigan and has designed and administered LANs for Michigan State University and Ameritech.

Read More Show Less

Read an Excerpt

Chapter 1: Perl and the Admin

If you are reading this book, chances are that either you are a system administrator who needs to automate administrative tasks, or you have an extraordinary sense of curiosity. Either way, you are embarking on a journey that will take you to the far reaches of administering Win32 machines.

As a system administrator, I quite often found myself having to automate tasks that my colleagues were content to do by hand. For some reason, they felt that adding tens of users at a time to a domain was best accomplished using the User Manager application. The closest they came to automating was using a batch file that deleted temporary files from the temp directory. If they ever needed to make environmental modifications on a wide scale (say, across thousands of machines), they would rather walk to each box, log on, and make the necessary modifications. I, on the other hand, found that approach simply an unacceptable waste of my time. In the time it would take me to modify two or three machines, I could have written a Pert script that would scurry across the network and make the necessary modifications on all the machines. The total turnaround time to hit all the computers on the network was in the scope of minutes, whereas my peers would require an entire weekend or more.

Scripting-whether in Pert, JavaScript, Visual Basic, Python, or any of a dozen other languages-is a tremendous way to automate, thus saving time, effort, and, in the end, money. In my mind, a system administrator must be able to effectively use a scripting language; otherwise, he is simply a knowledgeable computer user. You can follow this logic back to the UNIX platform, wherescripting was necessary to keep a machine configured properly. It is not untypical to see a UNIX box littered with shell, Pert, and other types of scripts. For some unfortunate reason, Win32 has departed from that trend. Win32 administrators far too often look to some third-party application that will magically perform some type of configuration or automation without having to write any code. Whereas such products ease the burden of administrating, it usually results in far fewer options for the administrator.

A Note About This Book

You should consider this book to be just a leaping point into administration using Win32 Perl. The information held within these pages is just a guide. Consider it a guide from a system administrator who has learned a few things. Almost all the extensions that I have authored have been to solve problems that I have encountered while managing Windows networks.

The sample scripts are designed to be functional and illustrate how particular problems can be resolved. The emphasis is on the latter more than the former. For example, many scripts use third-party extensions, such as win32 : : unman. Even though this extension is not yet part of the standard library, it provides a wonderful interface to the Win32 Lan Manager application programming interface (API). Other scripts, however, use the ever handy win32: : API to access functions that win32: : Lanman exposes. You might be confused why one script uses win32: : Lanman for some function but win32: :API for the same function in a different script. This is done on purpose. You should understand that Win32 Perl is much like Perl in general in that "there is more than one way to do it."

You will find that some scripts are useful but could be expanded to include some additional functionality. This is true; however, these scripts can consume much time in development, so to avoid "feature creep" (as well as "time creep"), some functionality has been ignored. Feel free to mangle these scripts to fit your particular need. I also hope that you will not only use the scripts, but study and learn the concepts behind them. These concepts can be indispensable when you're solving other similar, but different, problems.

Reusing Code

Having come from a C and assembler background, I have found that the ability to structure Perl scripts into discrete, reusable code chunks has made my life much easier. As a matter of fact, most coders feel the same way. Evidence of this can be found at any Comprehensive Perl Archive Network (CPAN) site, such as www. perl. com, where entire directories of donated chunks of code are available. Most of them are in the form of Perl extensions and modules-reusable code that others find beneficial...

Read More Show Less

Table of Contents

(NOTE: Each chapter ends with a Conclusion.)

1. Perl and the Admin.

A Note About This Book. Reusing Code. Perl.

Running Perl Scripts from a Command Line. Using Perl over a Network.

Extensions. Consistency. Administration and Computer Languages. Most Useful Extensions.

2. Account Maintenance.

Creating Accounts. Examining Accounts. Disabling Accounts. Deleting Accounts. Last Logon and Logoff. Unlocking Accounts. Expiring Passwords. Renaming Accounts. Privileges.

Displaying Available Privileges. Displaying Who Has a Privilege. Displaying and Modifying User and Group Privileges.

Synchronizing Domain Controllers.

3. Tools.

The File System.

Discovering Shared Directories. Volume Information. Creating Hard File Links. Creating Directories. NTFS Streams. Discovering File Versions.

Permissions.

Displaying Permissions. Displaying Verbose Permissions. Ownership. DCOM Configurations.

Registry.

Regfind. Setting Autologon. TCP/IP Configuration.

4. Crisis Management.

Backing Up and Restoring Network Shares. Backing Up and Restoring User and Machine Accounts.

Backing Up Machine Accounts. Restoring Accounts.

Backing Up and Restoring Permissions. Discovering Open Files. Closing Open Connections. Recovering Documents.

5. Monitoring and Reporting.

Detection. Alerting.

Event Logs. Event Logs and Message Tables.

Event Log Sources. Monitoring.

Monitoring Internal Processes. Monitoring Network Server States. Scanning Event Logs for Errors.

Creating an Alert.

Network Messages. Paging. Email.

6. Logon Scripts.

How Logon Scripts Work. Configuring Logon Scripts. Modifying the User Environment.

Environment Variables. Perl and Environment Variables.

Effectively Processing Logon Scripts.

Unified Logon Scripts. Processing User Groups.

Machine Setup Script.

7. Processes.

Win32 Processes. Creating Processes.

Backticks. Piping (with open()).The system() function. Win32::Spawn(). Win32: Process. Win32::AdminMisc. Forking.

Running Processes as Another User. Enumerating Processes. The PSAPI Library. Killing a Process.

TerminateProcess().kill().

Inheriting File Handles (Pseudo-Forking).

8. Win32 Services.

What Are Win32 Services? Controlling Services.

Lists of Services. Starting, Stopping, Pausing, and Resuming. Service Status.

Creating and Removing Services.

Installing Services. Reconfiguring a Service. Removing Services.

Running Perl Scripts as Win32 Services.

Services Using SRVANY.EXE. Services Using Win32:Daemon.

Issues with Perl-Based Services.

Debugging. Child Processes. Accounts. Obtaining CDO. Installing and Removing the Service. Using the Service.

9. ADSI and WMI.

Active Directory Services Interface.

How Do You Get ADSI? Learning About ADSI. Using ADSI.

The IIS ADSI Provider.

Discovering IIS Properties. Modifying IIS Properties. Displaying an IIS Tree.

Windows Management Instrumentation.

WMI Details. Discovering Disks on Remote Machines. Process Lists. Killing Processes. Creating Remote Processes.

Appendix A. Example Code and Online Book Discussions.

Modules Used in This Book.

Installing Extensions.

Perl Information.

Web Sites. Usenet. List Servers. Electronic Magazines and Journals. Worthwhile Win32 Perl Administration Books.

Index.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted February 9, 2001

    Not a book for beginners

    WIN 32 PERL is not a book for beginners. You are probably a systems administrator looking for solutions to you time-consuming administration tasks. If so, look this book over. The book is written in a small font making it a book you need to read when your mind is fresh. It does contain detailed coding information for the various system problems. WIN 32 PERL contains nine chapters explaining things from Monitoring and Reporting and Logon Scripts to ADSI and WMI. The content page is only three-and-a-half-pages long but the index of fifteen pages more than makes up for the lack in the content section. Finally, there is a 20-page review of other books available to assist you in your administrative needs.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted January 19, 2001

    Excellent Perl book

    If you think only O'Reilly can publish excellent Perl books give this a read. A real, no BS, approach to working with NT from the command line. If you are an NT Sys Admin and you're not already using Perl this book will get you on your way to simplifying your everyday work load. If you already use Perl for some tasks this will be an eye opener. The book will NOT make you a Perl expert and if you have no coding experience you can still use the scripts. If you have some coding experience you'll enjoy Roth's clean style. If your goal is to learn Perl from the ground up this book won't work for you. Try Johnson's Elements of Programming with Perl.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)