DELMIF.EXE: Delete-MIF File Creator

DELMIF deletes clients both up and down a hierarchy. DELMIF creates a delete-MIF file that deletes a client from a site database and all site databases above it.

Used in conjunction with a SQL trigger, DELMIF can be invoked automatically when a client is deleted. DELMIF can also be used to delete clients down a hierarchy by creating command files and sending them to child sites as PCMSVC jobs.

Runs On

Alpha, x86

Files Required for DELMIF

DELMIF.DLL

DELMIF.EXE

DELMIF Syntax

delmif SMSID [output_directory]

delmif @SMSID_file [output_directory]

SMSID

The SMS ID of the client to delete.

SMSID_file

A file containing several SMSIDs to be deleted, one per line. All characters after the first space on a line are ignored.

An easy way to create SMSID_file is to execute a query in the SMS Administrator (with SMS ID being the first column in the query output), highlight the machines, and paste them into a Notepad file.

output_directory

The directory where the delete-MIF file is written. The default is the LastLogonServerPath and ISVMIFCollectionPoint from C:\SMS.INI. The output directory can be on any logon server in logon.srv\isvmif.box, or on the site server in site.srv\isvmif.box. (The site.srv directory gives a slightly faster response). Microsoft recommends specifying an output directory.

DELMIF Example

The following command creates a delete-MIF file for the client with the SMS ID ABC00012:

delmif ABC00012

The following command creates a delete-MIF file for the client with the SMS ID ABC00345, and writes the delete-MIF file to D:\foo:

delmif ABC00345 d:\foo\

The following command creates a delete-MIF file for each client whose SMS ID is listed in DEL.DAT:

delmif @del.dat

DELMIF with a SQL Trigger

A SQL trigger allows you to delete clients by using either the SMS Administrator or DBCLEAN.EXE, and have delete-MIF files automatically generated. These delete-MIF files will flow up the hierarchy just like any other MIF file. (These MIF files get processed by the current site before being sent up the hierarchy, which could decrease performance on the current site server.)

To invoke DELMIF with a SQL Trigger, run the following commands from ISQL/W or a Query window in Enterprise Manager. You can copy and paste these two command groups into the SQL Query window.

It is strongly recommended that you modify the EXEC line to include an output directory (for example, exec master..xp_delmif @smsid, "D:\SMS\site.srv\isvmif.box\"). You must be logged in with sa access to create extended stored procedures. See also "Limitations."

From the Master database:

sp_addextendedproc 'xp_delmif', 'delmif.dll'

From the SMS database:

create trigger delmachine

on Machines

FOR DELETE

AS

DECLARE @smsid varchar(255)

DECLARE tIDs CURSOR FOR

select SMSID0

from MachineDataHistoryTable m (index=dwMachineID_idx),

Identification_SPEC i, deleted d

where i.datakey = m.SpecificKey and

     GroupKey = 1 and

     m.ArchitectureKey = 5 and

     m.dwMachineID = d.dwMachineID

open tIDs

FETCH NEXT

FROM tIDs

INTO @smsid

WHILE (@@fetch_status <> -1)

BEGIN

    exec master..xp_delmif @smsid

    FETCH NEXT

    FROM tIDs

    INTO @smsid

end

close tIDs

Limitations of Using DELMIF with a SQL Trigger SQL Server Running on a Standalone Server

The SQL trigger method works best when the instance of SQL Server containing the site database is on the site server or an SMS logon server. But an instance of SQL Server containing the site database on a standalone server creates a problem.

By default, SQL Server runs under the local system account, which is a special Windows NT account with full administrative access to the local computer, but no network access. Therefore, where can the program write the MIF file? (On site servers and SMS logon servers, there is a directory on the local computer to which the process can write.) There are at least two possible cures:

Performance Issue

There may be a performance problem if many machines are deleted at once.

Access to DELMIF.DLL

When using the SQL trigger, make sure the SQL Server process has access to DELMIF.DLL. This file should be placed either in the same directory as SQL Server, or somewhere in the path.