Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Perl For Windows System Administration

by ellem (Hermit)
on Mar 12, 2003 at 18:54 UTC ( #242467=perlmeditation: print w/replies, xml ) Need Help??

I am aware of several books on Perl for System Administration (and even one about Windows SA)ORA, New Riders.

That said...

I don't _need_ to use Perl everyday, although I like using it when I do. I like when I finally get it to "work as expected." I know I could be doing more with Perl.

So in my SA travels (currently in a W2K/Exchange shop) I use a few "canned" Perl scripts I wrote a while ago. As things come up I use Perl to solve them. Usually text maniplulation, moving things, reading things. Yet I want to do more.

I wonder what other SAs do with Perl. I run into two camps:

1 -- Scripting? You mean login script?
2 -- Use it for anything you do everyday.

With the first group I get the opportunity to introduce Perl and that gets me "in the groove". (Oddly I write better code for others than I do for myself...) With the second group I generally walk away shaking my head trying to think of something to do.

What's fun to do with Perl on W2K? What do you do as an SA with Perl that you can't imagine doing another way?
There's more than one way to do it, but only some of them actually work.

Replies are listed 'Best First'.
Re: Perl For Windows System Administration
by LAI (Hermit) on Mar 12, 2003 at 19:59 UTC

    I don't actually do any Win SA work with Perl. I kinda feel like anything done under Windows winds up hacked together and badly kludged, so as long as it's going to be done badly I might as well use one of the bits of software we've bought for the purpose. In Windows I always feel like I'm fighting against the way the system works in order to get anything done.

    All the automated stuff that's more general-use and non-platform-specific is run on one of our Linux servers. Stuff like regular tape backups, mailings to sales reps, archiving of various documents and reports in gzipped PDFs... all that's done with Perl or PHP. (It was all done in PHP before I got here :o)

    That said, I would very much like to install ActiveState's Perl on one of the Win2k servers to script tasks -- but then I'd still have to struggle with Windows' crappy automation mechanism. If only someone would implement a decent cron on Win32!

    Update: I just realized that I have no idea if anyone has written a decent cron for Win32. Anymonk know of one? (Thanks, zakb)



      I've had some success with this cron on Win2k. It's not got very good documentation, and it states it's 'freeware', but it does seem to work!

      You are singing my song there my fellow Monk!
      There's more than one way to do it, but only some of them actually work.
Re: Perl For Windows System Administration
by jacques (Priest) on Mar 12, 2003 at 20:36 UTC
    I am aware of several books on Perl for System Administration (and even one about Windows SA)ORA, New Riders.

    Windows books that you might be interested in:

    • Win32 Perl Programming: The Standard Extensions (2nd Edition)
    • Win32 Perl Scripting: The Administrator's Handbook
    • Learning Perl on Win32 Systems
    • Programming Perl in the .Net Environment
    All of these books are available through the major online retailers.
Re: Perl For Windows System Administration
by submersible_toaster (Chaplain) on Mar 13, 2003 at 02:37 UTC

    Ok , you can call me out on specific relevance here.., for the most part I astudiously avoid having to admin windows, (we have someone else for that). However there is plenty of glue and sticktape stuff between IRIX,Linux,OSX and windows that perl really helps with. If you're using exchange then I'm guessing that you also have an Active Directory, in which case I suggest you learn Net::LDAP which has negated hours of boring "click-edit-close,repeat" nonsense for me, in addition to the stickytaping of AD to an openLDAP directory (that is actually Organised!) <frothing>active -#%@#% directory #%^*#(</frothing>. If you enjoy a good reg-hack, and lets face it MS didn't remember to put enough buttons in Win2k and some stuff you can do no other way. Win32::TieRegistry even supports connecting to remote registries, I have used this in a previous job for auditing and reg-hacking.

    PS, in the days of NT4.0 I did use perl login scripts to do some drive mapping and attempted ENV magic.

    I can't believe it's not psellchecked
Re: Perl For Windows System Administration
by Jenda (Abbot) on Mar 13, 2003 at 13:06 UTC

    I'm no longer an admin, but I used to be. I used Perl under Windows for:

    • user creation : create an account in windows, in Unix, in SQL server, create the home directory, copy the default content, set permissions, etc. etc. etc. (I kept forgeting at least one of the necessary tasks if I had to do this all by hand)
    • automatic download and import of data: the users needed new (advertising related) data downloaded and imported into their software each day. Can you imagine having to do this by hand?
    • various data related tasks: take this ForPro database and that text file and import it into Oracle, copy this data from Notes to Oracle, delete this, recompute that ...
    • some a little crazy things like searching for Word documents through all user and group directories and changing the paper size to A4, changing Word templates to normal documents, etc. etc. etc.


      you are the greatest of all Admins... I weep from shame
      There's more than one way to do it, but only some of them actually work.
        I actually mean the above BTW. I am filled with shame for not doing the great things Jenda is doing
        There's more than one way to do it, but only some of them actually work.
Re: Perl For Windows System Administration
by Discipulus (Abbot) on Mar 13, 2003 at 14:06 UTC
    now my job is windoz SA junior (!!) and now I know the truth: WINDOWS SA IS A OXYMORON sentence, A NON SENSE.view my home node to know my situation.
    I notice that Perl works on win32 in a quiet good way when u use win32::someModule extensively(like OLE or TIE registry). I have worked with perl and win32 to managing IIS and to preventing his (or iis?) errors scanning the event viewer. Now I'm trying to play with DB, but the true dread for me is CGI on windowz.

    cheers from sunny rome
      You, and the other poster in this thread, are precisely the type of people I hope to never meet in real life.

      Have you considered that companies make large investments into software and systems, often times into Microsoft products, that they simply can not "drop" because an entire product is based around it?

      Have you considered that it takes as much time to become an expert with Microsoft products as it does with <insert other product here>? It requires time and effort, like anything else in this world.

      Have you considered that the industry is going through a very tight phase right now, and a number of my friends are without jobs, and a very jealous of my Win32 admin job?

      Are you so clueless as to realize that basic fundamentals do not change between systems? A web server is still a process on a port that uses the HTTP protocol; an email server is still a process that stores and relays messages using SMTP,IMAP, or your favorite protocol, regardless if it's Sendmail, Qmail or Exchange.

      Have you woken up enough to realize that Windows 2000 (all versions) can be configured and administered from a command line (cmd.exe for win2k)? Have you explored Active Directory Services Interface (ADSI) and Windows Management Instrumentation (WMI) as tools to built custom administration tools? Did you know perl has interfaces for WMI and ADSI?

      Did you guess that I've been both a unix and windows systems administrator? I learned different skills in each, but the basic fundamentals of systems administration does not change. Not only the technical parts, but the important parts of keeping a complex system running: documentation, communication, isolating problems, showing cause-and-effect, testing, backup, the list goes on.

      By the way, ActivePerl allows perl CGI apps to run under IIS quite nicely.


      $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
        Good grief it's a joke.

        As for the viability of running W2K from the command line; clearly you are mistaken. There are FAR too many things you CANNOT do from the command line. Further there are so many munged up things about W2K that it boggles the mind. Many of the tools I'll bet you use in your W2K day to day are nasty Unix hacks.

        Does this make Windows evil, or unworthy? No It makes it harder. And more tedious.
        There's more than one way to do it, but only some of them actually work.
      I have a saying:
      Saying you're a Windows Sys Admin is like saying you're a Flight Simulator Pilot.

      Guess what I do for a living. (Please God give me the chops to be a Unix admin!)
      There's more than one way to do it, but only some of them actually work.
        I am not a Windows Sys Admin, nor do I care to be one. But I have a lot of respect for those who do the job and do it well. Large Windows networks are not necessarily easy to administer just because most of the admin tools are GUI based, or because it's cool to hate Microsoft, or...

        If you'd rather be a Unix admin than a Windows Admin, that's cool. I'm just saying good Windows admins are as valuable as good Unix admins.

        I realize this is OT, so I'll try to redeem myself. A good Windows admin will use scripting to get the job done better, faster, and with more fun. A really good one will use Perl for even more fun. :)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://242467]
Approved by IlyaM
Front-paged by htoug
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (1)
As of 2022-10-01 02:49 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (126 votes). Check out past polls.