可以通过创建托管对象格式来定义自定义任务序列作、其属性和用户界面控件, (MOF) 文件来描述 类。 然后,使用 Mofcomp.exe 编译 MOF 文件。
有关自定义作 MOF 文件的详细信息,请参阅关于自定义作 MOF 文件Configuration Manager。
以下过程为在如何创建自定义作控件中创建的自定义作添加类声明Configuration Manager。
有关使用自定义作的信息,请参阅关于Configuration Manager自定义作客户端应用程序。
为自定义作创建 MOF 文件
在记事本中,创建一个新文件。
将以下 MOF 代码添加到 文件。
#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; };
将 替换为
REPLACESITECODE
Configuration Manager站点的站点代码。选择一个文件夹,并将文件保存为名为 CustomAction.mof 的类型
All Files
。打开命令提示符窗口,导航到保存 CustomAction.mof 的文件夹,然后输入以下内容:
mofcomp CustomAction.mof
按 Enter 编译 CustomAction.mof。
确认类已添加到 CIM Studio 中。 类应列为 SMS_TaskSequence_Action 的子类。
另请参阅
关于Configuration Manager自定义作关于Configuration Manager自定义作 MOF 文件如何创建Configuration Manager自定义作控件关于Configuration Manager自定义作客户端应用