IWMSPlugins.Remove (C#)

The Remove method removes an IWMSPluginIWMSPlugin Object (C#) from the IWMSPlugins collection.

IWMSPlugins.Remove(  object  varIndex 



[in] object containing the index or name of the IWMSPlugin object to remove.

Return Value

This method does not return a value.

If this method fails, it throws an exception.




varIndex is an invalid index location.


The plug-in could not be removed.


The plug-in cannot be removed while the publishing point is running.


This method causes the WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART flag to be set. Setting this flag indicates that the plug-in is to be removed when Windows Media server is restarted. The WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART flag can be cleared by setting the plug-in's Enabled property to true.

You can use the IWMSPlugin.Name method to find the plug-in name.

You cannot use the Remove method to remove the last instance of a system plug-in. For a plug-in that is implemented as a DLL, you can use RegSvr32.exe instead.


using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer          Server;
IWMSPlugins        Plugins;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSPlugins object.
    Plugins = Server.EventHandlers;

    // Set the first plug-in in the collection
    // to be removed when the server restarts.
    Plugins.Remove (0);
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
catch (Exception e) {
    // TODO: Handle exceptions.


Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows ServerĀ 2003 family, Windows ServerĀ 2008 family.

See Also


IWMSPlugin Object (C#)

IWMSPlugin.Name (C#)

IWMSPlugins Object (C#)