| title | Create a MOF File for a Custom Action |
|---|---|
| description | A custom task sequence action, its properties and its user interface controls are defined by creating a managed object format (MOF) file to describe the class. |
| ms.date | 09/20/2016 |
| ms.subservice | sdk |
| ms.topic | how-to |
| ms.collection | tier3 |
You define a custom task sequence action, its properties and its user interface controls by creating a managed object format (MOF) file to describe the class. The MOF file is then compiled by using Mofcomp.exe.
For more information about custom action MOF files, see About the Configuration Manager Custom Action MOF File.
The following procedure adds a class declaration for the custom action that you created in How to Create a Configuration Manager Custom Action Control.
For information about using the custom action, see About Configuration Manager Custom Action Client Applications.
-
In Notepad, create a new file.
-
Add the following MOF code to the file.
#pragma autorecover #pragma namespace("\\\\.\\root") // SMS Root Storage instance of __Namespace { Name = "SMS"; }; #pragma namespace("\\\\.\\root\\SMS") // Configuration Manager database name for this computer. instance of __Namespace { Name = "site_REPLACESITECODE"; }; #pragma namespace("\\\\.\\root\\SMS\\site_REPLACESITECODE") #pragma classflags("forceupdate") [ CommandLine("smsswd.exe /run:%1 Application.exe /user:%2"), VariablePrefix("MyCustomActionPrefix"), ActionCategory("My Custom Action Category,7,1"), ActionName{"ConfigMgrTSAction.dll", "ConfigMgrTSAction.Properties.Resources", "ConfigMgrTSAction"}, ActionUI{"ConfigMgrTSAction.dll", "ConfigMgrTSAction","ConfigMgrTSActionControl", "ConfigureTSActionOptions"} ] class ConfigMgrTSActionControl : SMS_TaskSequence_Action { [TaskSequencePackage, CommandLineArg(1)] string PackageIDForApplicationExe; [Not_Null, CommandLineArg(2)] string User; [VariableName("CustomLocation")] string Location; }; -
Replace
REPLACESITECODEwith the site code for your Configuration Manager site. -
Choose a folder, and save the file as type
All Fileswith the name CustomAction.mof. -
Open a Command Prompt window, navigate to the folder that you saved CustomAction.mof in, and enter the following:
mofcomp CustomAction.mof -
Press ENTER to compile the CustomAction.mof.
-
Confirm that the class has been added in CIM Studio. The class should be listed as a child class of SMS_TaskSequence_Action.
-
Complete How to Use a Configuration Manager Custom Action Control.
About Configuration Manager Custom Actions About the Configuration Manager Custom Action MOF File How to Create a Configuration Manager Custom Action Control About Configuration Manager Custom Action Client Applications