MGT304: PowerShell: Next Generation Command Line Scripting

Back when I was in high school I ran an after-hours bulletin board (you know, back when e-mail = FidoNet). Originally I ran the system on top of MS-DOS using the Maximus BBS package – it completely cracks me up that this software is still under active development and hosted up on SourceForge.

Eventually I migrated over to OS/2 which enabled me to run one line full time and an additional line after hours. Operating systems like OS/2 and DESQview were frequently used by BBS sysops because they were better at handling serial comms.

Of course, running a bulletin board involved more than just installing and configuring an operating system. Most bulletin board platforms like Maximus were really a framework upon which the sysop could build custom user interface and it was the process of taking groups of ASCII files and transforming them into the proprietary Maximus screen format (Mecca files). I would keep all of my ASCII files in a sub-directory and then after each change and do a batch conversion – the command that I issued looked something like the following:

for %f in (*.*) do build.bat %f

This would loop through each of the files that matched the filespec (*.*), and for each one call build.bat (a little batch file that I had strung together to do a couple of different things, including taking backups of existing files) – %f would contain the name of the file which is the subject of each loop.

Simple commands and scripts like this made my life a lot easier, and once I graduated from running a bulletin board to performing systems administration functions on computer networks I took my scripting skills with me.

Over the years I’ve used shells like bash, csh and ksh. I’ve also used Perl quite a bit. These shells give us quite bit of functionality and their use is considered a core skill for many UNIX system administrators. As dynamic languages like Python and Ruby get more popular in sysadmin circles, the boundaries of what is possible are being expanded – but where does this leave Windows system administrators?

The good news is that Microsoft has not been sitting idle and has been building a new command line and scripting environment for windows called PowerShell. In this session at Tech.Ed I’ll introduce PowerShell, look at what role it will plays in the future of platform administration on Windows.

What is the equivalent of the script above?

get-childitem | build

Of course, that assumes that I’ve got a function or cmdlet defined called “build”, but lets just pretend I do for now eh? See you in the session!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s