Michael Niehaus
An Overview
Now that we’ve created the “better connection” script for connecting to
SMS from VBScript, the next step is to convert this function to be used with
other tools.  In this article, we’ll cover three examples:
Now that we’ve created the ‘better connection’ script for connecting to SMS from VBScript, the next step is to convert this function to be used with other tools. In this article, we’ll cover three examples.
Next up: some simple but useful queries, looking at systems (PCs), packages,
collections, advertisements, and more.  But first…
So what does it take to modify the VBScript function presented in the previous
article to be used in an Active Server Page?  Simple: absolutely nothing – it can
be used as-is.  Take the source from the last time,
strip out everything except the function itself.  Surround the code with “” to indicate that this is VBScript, then save it into a file
(e.g. “SMS_Connect.inc”) that can be included into each Active Server Page
that needs to talk to SMS.  The result should look like:
So let’s create a web page that uses the file. Here’s the basic web page:
Connect to SMS Successfully connected to SMS.
Save this as a file (e.g. “SMS_Connect.asp”) and execute it from a web browser.
The page doesn’t do much, but if it can be loaded, everything is working.  (If any
errors are encountered, the page will stop loading before the “Successfully connected”
message is sent, so all you’ll see is the error information.)
So what if it doesn’t work? There are three possible problems:
The first two items should be fairly obvious, but the third requires further
explanation.  First, if you are running this script on a Windows NT 4.0 server,
you need to make a registry change in order to access WMI via an Active Server
Page.  This is documented in the 
Platform SDK.  For some reason, this is not an issue with Windows 2000.  Go
figure.
Second, Active Server Pages normally run under the context of a local machine
account named something like “IUSR_” which is only a member of the
machine’s (or domain’s, if this is a domain controller) “Guests” group, giving
it little security.  This security normally does not include the ability to
connect to SMS.  Some ways to fix this:
IIS security is an art form.  There are usually several ways to do it, but the
way you choose to implement is a matter of personal preference.  I’m sure there
are other ways to achieve the same result – use whatever works for you.
Next time when working with queries we’ll create a web page that does something
a little more useful.
Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.