Share via


Registering a Script Component

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

  • Registering a Script Component for Remote Instantiation

  • Unregistering a Script Component

Registering a Script Component

You can register a script component on a local computer using a variety of methods.

To register a script component

  1. In Windows Explorer, right-click the script component (.wsc) file, and then choose Register.

    –or–

  2. 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–

  3. If you do not have the version of Regsvr32.exe that ships with the script component package, use the existing version and register the script component run-time DLL using syntax such as the following:

    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:https://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

  1. 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.

  2. 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.

  3. 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.

See Also

Concepts

Creating Registration Information

Script Component File Contents

Using a Script Component in an Application