How to Delete a Driver Package in Configuration Manager

 

Updated: November 1, 2013

Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager

You delete an operating system deployment driver package, in System Center 2012 R2 Configuration Manager, by deleting its SMS_DriverPackage object.

System_CAPS_noteNote

Windows drivers that are referenced by the driver package are not deleted.

To delete a driver package

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

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

  3. Delete the SMS_DriverPackage object.

Example

The following example method deletes a driver package identified by its package identifier.

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

Sub DeleteDriverPackage(connection,packageID)

        ' Get the driver.
        Set driverPackage = connection.Get("SMS_DriverPackage.PackageID='" & packageID & "'")

        ' Delete the driver package.
        driverPackage.Delete_

End Sub
public void DeleteDriverPackage(
    WqlConnectionManager connection, 
    string packageId)
{
    try
    {
        // Get the driver package.
        IResultObject driverPackage = connection.GetInstance("SMS_DriverPackage.packageId='" + packageId + "'");

        // Delete the driver package.
        driverPackage.Delete();
    }
    catch (SmsException e)
    {
        Console.WriteLine("Failed to delete driver package: " + 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.

packageID

  • Managed: String

  • VBScript: String

  • The driver package identifier available in SMS_DriverDriverPackage.PackageID.

Compiling the Code

This C# example requires:

System

System.Collections.Generic

System.Text

Microsoft.ConfigurationManagement.ManagementProvider

Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine

microsoft.configurationmanagement.managementprovider

adminui.wqlqueryengine

Robust Programming

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

.NET Framework Security

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

Show: