Microsoft® Windows® Script Component Registering a Script Component |
Script Component Tutorial Previous Next |
To register a Windows® Script Component, you must have the script component run-time Scrobj.dll available, and it must be registered on your computer. When you install the script component package from the Microsoft® Scripting Technologies Web site, Scrobj.dll is automatically loaded and registered on your computer.
Note Registration is not required if you are creating a script component to be called via DHTML Behaviors, because Microsoft®Internet Explorer 5.0 can use this type of script component without prior registration.
This topic provides information about:
Registering a Script Component
You can register a script component on a local computer using a variety of methods.
To register a script component
- In Windows Explorer, right-click the script component (.wsc) file, and then choose Register.
or
- Use the new version of Regsvr32.exe that ships with the script component package, and use this command:
regsvr32 URL/component_name.wsc
For example, to register a script component called MyComponent.wsc, use syntax such as this:
regsvr32 file:\\myserver\MyComponent.wsc
or
regsvr32 scrobj.dll /n /i:URL/component_name.ext
For example, to register a script component called MyComponent.wsc, use syntax such as this:
regsvr32 scrobj.dll /n /i:http://myserver/MyComponent.wsc
Registering a Script Component for Remote Instantiation
If you intend to create a remote instance of a script component, the script component must be registered on the remote computer where it resides. You must also register it on each local computer from which you intend to instantiate the script component, so that DCOM can have a starting point in the registry from which to find and instantiate the remote script component.
To register a script component for remote instantiation
- Determine the program ID and class ID of the script component to be instantiated remotely.
Note The script component must have the same class ID on both the local and remote computers, so you must provide a class ID in the script component's <registration> element.
- On each local computer, create the following registry entry:
HKEY_CLASSES_ROOT\componentProgID
where componentProgID is the program ID of the script component to instantiate.
- Under the new entry, create the CLSID key and set its value to the class ID of the script component, enclosing the class ID in brackets.
Tip An easy way to create the proper registry information is to register the script component on the server where it will be instantiated. Then using Regedit.exe, locate the HKEY_CLASSES_ROOT\componentProgID entry. From the Registry menu, choose Export Registry File, which creates a .reg file. This file can be distributed to local computers, and users can simply run the file to create the appropriate registry entries.
Unregistering a Script Component
If you no longer need to have a script component registered on your computer, you can unregister it using one of these methods:
- Right-click the script component file name in Windows Explorer, and then choose Unregister.
- Run Regsvr32.exe with the -u flag.