[THIN] Re: VBScripts

  • From: Martin Stephenson <martin.stephenson@xxxxxxxxx>
  • To: thin@xxxxxxxxxxxxx
  • Date: Fri, 22 Apr 2005 08:46:58 +1000

Please see my responses inline...

On 4/21/05, Braebaum, Neil <Neil.Braebaum@xxxxxxxxxxxxxxxxx> wrote:
> Comments inline...
> 
> > -----Original Message-----
> > From: thin-bounce@xxxxxxxxxxxxx
> > [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf Of Martin Stephenson
> > Sent: 20 April 2005 23:25
> > To: thin@xxxxxxxxxxxxx
> > Subject: [THIN] Re: VBScripts
> >
> > I thought someone would ask me to back up my claim.
> 
> I said that for a reason - because as somebody who's extensively used
> both, there isn't much credence in it.
> 
> For system admin / AD maintenance, IME vbcscript and ADSI is a better
> choice / fit. For login scripts, no question, Kixtart is head and
> shoulders, *significantly* better and more suited.
> 
> > I was
> > going to say that you couldnt use any WMI functions in
> > Kixtart but I thought I should read the manual of the latest
> > release first and sure enough, I discovered you can call WMI
> > functions.  Not that I have tried this in Kixtart though.  I
> > first used Kixtart in the mid 90's on a Lan Manager site but
> > by the late 90's had discovered VBScript, which was at the
> > time streets ahead of Kixtart.
> 
> Something of hyperbole, there. ADSI had support for active directory,
> perhaps a little before Kixtart, but not much.

One of the reasons I switched over to VBScript in the late 90's (about
'99 i think) was because I couldnt call COM objects in Kixtart.  I
needed to write a script that would control applications that leaked
memory on NT4 TS which was something that Kixtart could never do. 
Sure it wasnt a login script but it was a script written by a sys
admin to administer a Citrix Farm.

> 
> Something to bear in mind, here - Kixtart was designed for the login
> environment - and as such, is significantly more suited to it, that
> vbscript / WSH / ADSI / WMI is.

I totally agree with this.  For Login scripts its pretty hard to go
past Kixtart for its no fuss simplicity and ability to perform all of
the required functions you would need in a login script.  And for many
sites, login scripts maybe the only scripts that sys admins ever
write.

> 
> Think about this - say in your login script, you want to map a few
> drives, copy a couple of files, and write some registry values.
> 
> Contrast the differences between doing this in Kixtart, and vbscript.

Yes this is much easier in Kixtart.  However once you have a library
of VBScript Functions and Sub routines to call, then you realise you
can effectively write one line commands to copy files, map drives,
printers and registry values in VBScript.

Sure if you count the number of lines to perform these functions in
Kixtart, its a lot less code.

> 
> For system admin tasks it's a different matter - I wouldn't dream of
> using Kixtart for that - and it's of no use to me when I want to write
> an HTA.
> 
> > So after browsing the Kixtart Manual and my O'Reilly's
> > VBscript manual, I have come up with a very short list of
> > functions available in VBScript which are not (AFAIK)
> > available in Kixtart.
> >
> > InputBox - displays a dialog box and requests a users input,
> > not just yes or no.  Quite handy really.
> 
> MESSAGEBOX? How long has that been in Kixtart!

I've written a few VBScripts where you prompt the user for information
like the path to save an output file or their new phone number.  The
phone number example was placed in a VBScript Login script that was
triggered to run at the beginning of every month, prompting users to
update their phone number in AD.

I didnt realise that Kixtart MESSAGEBOX function allowed the user to enter data.

> 
> > GetTempName - Returns a string containing a valid Windows
> > temporary filename.  I've used this to generate a temporary
> > data folder that you know will not already exist, which is
> > quite handy.
> >
> > IsArray - Indicates whether a variable is an Array.
> >
> > Mathematical Functions
> > Log, Sgn, Sin, Sqr, Tan - well I have never used these myself
> > and there probably not commonly used in VBScript.  I suspect
> > mathematicians use a language with a far greater range of
> > math functions.
> 
> There are a number of things that may well be largely unique to either
> of the scripting languages.
> 
> The point being, though, that you have to jump through hoops to make
> vbscript / WSH / ADSI and WMI to do many of the common login script
> activities.
> 
> The anomaly that I see is that many vbscript advocates, advocate it for
> everything, even when it's clearly not suited or the optimal tool.
> 
> I've been writing ADSI / vbscripts for years, and have even developed
> reasonable sized applications and HTAs with it. As likewise I've been
> writing Kixtart scripts for years, too.
> 
> The facts remain, vbscript is a poor cousin when it comes to login
> scripts - it's overly complex, unwieldly, and requires almost
> inappropriate interfaces to do anything half-decent. This is where
> Kixtart excels.
> 
> Sure, you can jump through hoops to write overly complex login scripts
> using vbscript, and use WMI so that you can write binary values of
> decent length - but it's a damn sight easier in Kix.
> 
> As likewise, you could use Kixtart to write complex sys admin scripts,
> but it's not the best / most optimal tool for it - vbscript is much
> better for that, or stuff that you may incorporate into a web page (well
> actually javascript is much better for that).
> 
> > There are other advantages to VBScript for instance the code
> > is easily ported to and from Visual Basic (not sure about
> > VB.net though) and there is a huge number of VB programmers
> > and free source code to tap into.
> >
> > As I dont want to start a religious war here, if either
> > product works for you, then by all means stick with it.
> 
> My only reason for pointing out the fallacies in this, is trying to make
> the wrong tool more suitable for certain tasks.
> 
> By any stretch of the imagination, vbscript is unwieldly for login
> scripts, and Kixtart is unwiedly for admin scripts.
> 
> Yet it always seems to be the vbscript exponents who'll try and make it
> fit to every scenario, even if it's the wrong tool of choice for the
> requirement.
> 
> Neil
> 

I guess I'm just a lazy programmer in that I prefer to stick to one
language for all of my tasks.  I made a choice in the late 90's to use
VBScript and have used it since to write dozens of sys admin type
scripts.  From my point of view if I'm writing scripts for ASP pages,
ADSI edits, process management, file manipulation and login scripts,
I'd rather use one language that does it all.  For me I use VBScript
for all of this.  If other people want to use Kixtart or any other
language to perform the tasks they need to get done, well thats fine
by me too.

Cheers,
Martin.
********************************************************
This Weeks Sponsor: RTO Software TScale
TScale provides a cost-effective way to improve performance, capacity and 
stability for thin-client servers like Citrix MetaFrame or Microsoft Terminal 
Services running Windows NT, 2000 or 2003.
http://www.rtosoft.com/enter.asp?id)6
**********************************************************
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
ThinWiki community - Excellent SBC Search Capabilities!
http://www.thinwiki.com
***********************************************************
For Archives, to Unsubscribe, Subscribe or
set Digest or Vacation mode use the below link:
http://thin.net/citrixlist.cfm

Other related posts: