다음을 통해 공유


How to Delete a Windows Driver from Configuration Manager

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

You delete a Windows driver from the operating system deployment driver catalog, in Microsoft System Center Configuration Manager 2007, by deleting its SMS_Driver Server WMI Class object. When you delete a driver, its definition is deleted, and it is no longer matched by the apply driver action task sequences. However, if the content associated with the driver was added to a driver package, or if the driver was added to a boot image package, the content remains there until the packages are updated.

To delete a Windows driver

  1. Set up a connection to the SMS Provider. For more information, see About the SMS Provider in Configuration Manager.

  2. Get the SMS_Driver object for the driver that you want to delete.

  3. Delete the SMS_Driver object.

Example

The following example method deletes a driver identified by its CI_ID property value.

For information about calling the sample code, see Calling Configuration Manager Code Snippets.

Sub DeleteDriver(connection,driverID)
    
        ' Get the driver.
        Set driver = connection.Get("SMS_Driver.CI_ID=" & driverID)
        
        ' Commit changes.
        driver.Delete_

End Sub
public void DeleteDriver(
    WqlConnectionManager connection, 
    int driverId)
{
    try
    {
        // Get the driver.
        IResultObject driver = connection.GetInstance("SMS_Driver.CI_ID=" + driverId);

        // Delete the driver.
        driver.Delete();
    }
    catch (SmsException e)
    {
        Console.WriteLine("Failed to delete driver: " + e.Message);
        throw;
    }
}

The example method has the following parameters:

Parameter Type Description

Connection

  • Managed:WqlConnectionManager

  • VBScript: SWbemServices

A valid connection to the SMS Provider.

driverID

  • Managed: Integer

  • VBScript: Integer

The Windows driver identifier available in SMS_Driver.CI_ID.

Compiling the Code

This C# example requires:

Namespaces

System

System.Collections.Generic

System.Text

Microsoft.ConfigurationManagement.ManagementProvider

Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine

Assembly

microsoft.configurationmanagement.managementprovider

adminui.wqlqueryengine

Robust Programming

For more information about error handling, see About Configuration Manager Errors.

Security

For more information about securing Configuration Manager applications, see About Securing Configuration Manager Applications.