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.