GetObject Function
Main Menu
Description
Returns a reference to an object or component that the function has been pointed to.

Syntax

GetObject([pathname] [, class])

The GetObject function syntax has these parts:

Part Description
pathname Optional; String. Full path and name of the file containing the object to retrieve. If pathname is omitted, class is required.
class Optional; String. Class of the object.

The class argument uses the syntax appname.objectype and has these parts:

Part Description
appname Required; String. Name of the application providing the object.
objectype Required; String. Type or class of object to create.

The GetObject function gives access to view and alter key IIS functionality, access unregistered java object, unregistered Windows Scripting Component or other supported script type, reference to an object by it's class ID in the registry, Windows OS functionality, access to a running object instance, call queued components, COM component and including queued components.

The example here below works on ASP and VBScript, it is based upon getting access to an unregistered Windows Scripting Component, that need to be place on to the test server or work staition before running, or this example will not work.

Below is a ASP vertion. (for file "test.asp")

<%
Dim test
set test = GetObject("script:c:\temp\test.wsc")
Response.Write test.info
%>

And below is an VBScript vertion. (for file "test.vbs")

Dim test
set test = GetObject("script:c:\temp\test.wsc")
Wscript.Echo test.info

Both the ASP and VBScript example use an Windows Scripting Component called "test.wsc" and below is the data needed to make the file.

<?xml version="1.0" encoding="utf-8" ?>
<component id="component2">
<registration progid="test.output"/>

<public>
<property name="info">
<get internalName="thisisatest"/>
</property>
</public>

<script language="VBScript">
<![CDATA[
Function thisisatest()
thisisatest = "I am test output"
End Function
]]>
</script>
</component>

This example has been tested on both a windows 2003 server and on XP workstation and has been seen to work.

The GetObject function has a great number different ways that it can be used dependent upon the particular component object or module that it is used to run or executed.
So that its possibilities can be understood better, below is a simple table explaining some of the front-end arguments that can be employed in using the GetObject function.

GetObject( ) argument
Argument Allows Access Too

"clsid:<clsid>"

reference to an object by it's class ID in the registry.

"iis:<metabasepath>"

Give access to Allows a programmer to view and alter key IIS functionality for any webserver physically connected to the server or workstation.

"java:<classname>"

Allows a reference to unregistered java object found in the %system root%\java\trustlib folder using on window 2003 servers.

"new:<clsid/progid>"

Allows instancing of any COM component.
"OBJREF:<base64encodedstring>"
Gives access to a running object instance

"queue:<clsid/progid>"

Used to activate a queued COM+ component via Message Queuing.

"script:<absolutepath>"

Reference to an unregistered Windows Scripting Component or supported script type.

"WinMgmts:<string>"

Gives access to base Windows OS functionality.

related to
CreateObject


Main Menu