From: MikeB on
I got hold of a scripting book "Windows 2000 Windows Script Host" by
Tim Hill.

This was on the recommendation of someone as a very good starter in
scripting.

This book says that the samples can be downloaded from the website
macmillantech.com, but that website seems defunct now. :( Is it
possible that they went out of business? Does anyone here know if the
website has moved, or perhaps even as a desperate grasp, does anyone
here perhaps have a copy of the samples accompanying this book?

I'd try contacting the author, but it seems he has not published
anything since this book (if I read amazon.com correctly) and hence he
may not be around either. Bummer.

I have other scripting books, but I keep getting confused about the
differences in WSH and VBscript and what objects belong where and so
forth. I was hoping that going back to the inception of WSH might help
me.

And then, there is also Windows power shell. :( But that is another
kettle of fish.
From: Mayayana on
I just looked around myself and only found dead
links. It appears that many of the tech. publishers
have been sold multiple times.

You should be able to find samples for just about
anything online, though.

As interpreted script code, VBS requires some kind
of host interpreter. That can be WSH, or IE in webpage
script, or ASP on Windows servers, etc.

The WSH is the "engine" that parses and runs VBScript
on Windows. It has some objects associated with it.
In particular, there are the objects coming from scrrun.dll
and wshom.ocx: FileSystemObject, WScript.Shell, etc.
But those objects are just somewhat of a willy nilly collection
of things that the original designers thought might be
needed by people using WSH.

There are no VBScript objects per se, but VBS can use any
COM object with a dispatch interface. The objects that
come with WSH are sort of a "starter kit" that can be
depended upon to exist on most machines. Then there
are other common objects like IE, Shell.Application,
WMI, WindowsInstaller, etc. Those are not part of WSH
but they're available on almost all machines. So it's not
unusual to see those objects discussed here. There are
also lots of 3rd-party objects. And if you're doing WinNT
admin. there are lots of commandline EXEs that have nothing
to do with VBS or WSH, but which are nevertheless available
and commonly used.

> I was hoping that going back to the inception of WSH
> might help me.

In a nutshell.... there was Netscape using Javascript,
and Unix people had shell scripting for server management.
On Windows there was only left-over DOS for automation
scripting.

Then Microsoft
came out with Internet Explorer to compete with Netscape.
They provided IE with 2 optional scripting languages:
VBS and JS. If you look at older VBS books you'll see that
they only deal with the IE DOM. Circa 1996 VBS was expected
to become a second web scripting language. There was
no WSH.

Fast forward a couple of years, to about 1998. Windows
admins were asking for something GUI-based to replace the
outdated command line of DOS .BAT scripts. Microsoft
created the WSH functionality with one simple change: the
ability to instantiate COM objects using CreateObject (vbs)
or ActiveXObject (js). They also created ActiveX controls,
which are basically COM libraries.

With ActiveX controls and pre-installation of IE in
Windows, Microsoft was able to defeat Netscape, while
at the same time digging IE's grave. IE was never again
safe to use online. But it was extremely flexible due
to the power of ActiveX controls. On Windows MS came
up with the WSH to satisfy the call for GUI scripting.
At the time I think that MS didn't think very much was
needed. They came out with very limited functionality in
FileSystemObject and WSCript.Shell, built the WSH, and
shipped the new GUI shell scripting system.

In the 12 or so years since
then there has been very little update to WSH. FSO still
can't even handle binary files without jumping through
hoops. But since VBS can use COM objects, which are
basic to the Windows OS, there's almost no limit to
what can be done with VBS.

That's why it's so hard to get a handle on what's
available. You can use VBS to access WMI, but WMI
is not part of WSH. You can automate Windows
Installer, but that's not part of WSH, either. People
often ask what objects are available, but it just isn't
a defined set of objects. You can see a good example
of that with the WSH help. It doesn't list Shell.Application.
Most people think of Shell.App as part of WSH, but it's
actually just a scriptable interface to the Shell API
that handles Explorer folder views. It comes from
shdoc401.dll on pre-XP systems, and shell32.dll on
XP+. It's built in, basic GUI APIs. The fact that script
can use it is probably an accident, left over from
Active Desktop. With Active Desktop, pre-XP, folder
windows were actually webpages. Microsoft wrote
a scriptable interface for the folder view functionality
so that it could be used in that webpage, folder.htt.
With XP they maintained compatibility. So the
Shell.App Windows collection still returns a set of
open IE and Explorer windows, as InternetExplorer
objects! Yet in XP there is no connection at all between
IE and Explorer.

Sorry to go on so long. I hope this isn't too
confusing. I think what it boils down to is that
much of what happens in Windows is a combination
of impulse, marketing gimmicks, new technology,
and fashion. The WSH is a very good example of
all those things put together, in no particular order.

(Likewise, PowerShell owes it's existence to the
competition with Linux/Unix servers, combined
with a fashion resurgence in terms of command
line. Now that everyone has snazzy 3-D GUIs, a
black console screen and typed commands has
become a rugged, back-to-nature craze. :)


From: MikeB on
On Apr 30, 6:16 pm, "Mayayana" <mayay...(a)invalid.nospam> wrote:
>   I just looked around myself and only found dead
> links. It appears that many of the tech. publishers
> have been sold multiple times.
>
... wow, thanks. That was interesting. Not great from an "invest in
learning this technology" pov, but interesting nonetheless.

From: Mayayana on

>
... wow, thanks. That was interesting. Not great from an "invest in
learning this technology" pov, but interesting nonetheless.

:) Microsoft has been sort of "deprecating" VBS
more recently. They're targetting PowerShell at
corporate admins and generally discouraging
anything else. Even with programming, MS is
pushing "managed" code with .Net, discouraging
people from using the API.

So I guess in that sense, too, VBS is not a
promising tool.

On the other hand, I doubt that MS will break
VBS and WSH anytime soon. There are problems
with increasing restrictions like Windows File
Protection, code signing, IE security, permissions
issues, etc., but not with general support. WSH is
still there in Win7.

I use VBS a lot because it's *so* flexible for
writing little utilities that would take much more
work if written as native executables. Just last
week I wrote a script to unpack HXS help files
(with the help of 7-Zip), build an index, and display
it all in an HTA-based viewer.

While MS keeps replacing one thing with another,
they rarely actually break things in a big way. I
still use VB, for instance. MS hasn't officially supported
VB for a long time. But what MS supports is largely
irrelevant. VB is arguably the most supported tool
available to this day, in the sense that VB software
runs on virtually every Windows machine in the world
without installing any support files. While Microsoft's
newest .Net requires a 300+MB runtime.

If I haven't scared you off, and you're still looking
for books, you might check the Dino Esposito books.
I always find his writing pithy and concise. He's also
written a number of interesting articles for MSDN magazine
over the years, many of which can probably still be
found online.


From: Richard Mueller [MVP] on

"MikeB" <mpbrede(a)gmail.com> wrote in message
news:1aab0c35-d5f7-49a8-8e44-b07ac3e3872b(a)o11g2000yqj.googlegroups.com...
>I got hold of a scripting book "Windows 2000 Windows Script Host" by
> Tim Hill.
>
> This was on the recommendation of someone as a very good starter in
> scripting.
>
> This book says that the samples can be downloaded from the website
> macmillantech.com, but that website seems defunct now. :( Is it
> possible that they went out of business? Does anyone here know if the
> website has moved, or perhaps even as a desperate grasp, does anyone
> here perhaps have a copy of the samples accompanying this book?
>
> I'd try contacting the author, but it seems he has not published
> anything since this book (if I read amazon.com correctly) and hence he
> may not be around either. Bummer.
>
> I have other scripting books, but I keep getting confused about the
> differences in WSH and VBscript and what objects belong where and so
> forth. I was hoping that going back to the inception of WSH might help
> me.
>
> And then, there is also Windows power shell. :( But that is another
> kettle of fish.

I would just add that I still use Tim Hill's "Windows 2000 Windows Script
Host". If you have the book, there is little need for the online code.
Another good book, especially if you write scripts to query or administer
AD, is "Microsoft Windows 2000 Scripting Guide - Automating System
Administration". I have the book, but fortunately the text is still
available online at:

http://technet.microsoft.com/en-us/library/ee221103.aspx

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--