Re: Want to learn scripting.... by Alex
Alex
Tue Mar 04 09:17:39 CST 2008
I've been out of the loop in VBScript/PowerShell newsgroups for over a
year, but there are some quick comments I want to make based on my beta
experience and real use over the last few years. I just wanted to remark on
some of your points from an admin perspective. Also crossing post to the
PowerShell newsgroup. :)
"ekkehard.horner" <ekkehard.horner@arcor.de> wrote in message
news:47cd2b3d$0$25514$9b4e6d93@newsspool1.arcor-online.net...
> Do you think that this:
>
> (1) To use Powershell you must
> - install it
> - learn a new (type of) language
> - learn about the .NET framework to use new features you
> can't use with VBScript
For scripting, it's definitely a new language with its own syntax (albeit
somewhat similar to Perl). However, since it is primarily a shell, you can
freely use it with existing WSH scripts and any other tools you have
(including older console applications and those built for .NET).
> (2) The C# compiler comes with the .NET runtime; a very good IDE
> is free (Express edition)
>
> (3) While neither C# nor VB.NET are as 'simple' as VBScript, at least
> they are similiar
The free C# compiler is a definite plus. I wouldn't say that it's similar to
VBScript, however. Even VB.NET is dramatically different in its behaviors
(and requires the same .NET learning curve as any other approach).
> (4) So if you are starting sysadmin programming right now, use
> C# (or VB.NET)
>
> is a valid argument? (I'm not sure, because I'm a programer, not
> a sysadmin.)
For actual _programming_, I can see a reason to pick up C#. For typical
admin use, however, the critical point that makes PS so valuable is that it
is a _shell_ first and foremost. The standard administrative approach to
solving a problem is rapidly trying to solve the problem interactively,
figuring out what's going on on-the-fly, then repeating it a lot of times.
Generally speaking, I've found that with PowerShell I can quickly solve
specific problems. In the same timeframe I'd only have a WSH script
prototyped, and I probably wouldn't even be to the first C# compilation
attempt.
This does NOT eliminate WSH/VBScript; if anyone doubts that, take a look at
techniques such as those demonstrated by Bruce Payette in PowerShell in
Action for invoking Active Scripting languages on the fly. The same thing
goes for C#; half the beta period was focused on providing a good
programming framework that makes PowerShell an attractive foundation for
.NET code designed to solve admin problems. The real truth of the matter is
that all 3 tools - WSH, PowerShell, and .NET - are designed to solve
slightly different problems. For that reason, they each have a role. For
administrative task-solving, however, I'd say that PowerShell is the
front-line tool in the forseeable future.