Does anyone know how to build a custom SMS Package based derived from SMS_PackageBaseClass?
-
Tuesday, January 17, 2012 11:39 PM
I want to build a custom WMI class "MYSMS_Package" derived from "SMS_PackageBaseClass." This way I can build my own node in config manager where I can query just the "MYSMS_Package" type and it will not show up under "Software Distribution."
So far, all I have is an MOF file that is basically a copy of the SMS_Package:
[dynamic: ToInstance, provider("ExtnProv"), DisplayName("MY SMS Package"), Secured, Icon("Package.ico")] class MYSMS_Package : SMS_PackageBaseclass { [Description("This method causes a refresh of the package source. For use when the Package properties have not changed."), implemented] sint32 RefreshPkgSource(); [Description("Retrieves the id number that will be used for the next package created."), static, implemented] sint32 GetNextID([out] uint32 NextID); [Description("Sets the id number that will be used for the next package created."), static, implemented] sint32 SetNextID([in] uint32 NextID); [Description("Sets the source site to the current site, unlocking the package."), implemented] sint32 Unlock(); [Description("Changes the source site code."), implemented] sint32 SetSourceSite([in] string SourceSite); [Description("Add the distribution points."), implemented] sint32 AddDistributionPoints([in] string SiteCode[], [in] string NALPath[]); [Description("Adds package change notification."), implemented] sint32 AddChangeNotification(); [Description(" Method: CheckDuplicateShareName().Check if the specified share name has been used by other package."), implemented, static] sint32 CheckDuplicateShareName([in] string ShareName, [in] string PackageID = "", [out] boolean IsDuplicated, [out] string DupPkgName = "", [out] string DupPkgID = "", [out] sint32 DupPkgType = 1); [Description(" Method: CheckDuplicateSourceName().Check if the specified source name has been used by other package."), implemented, static] sint32 CheckDuplicateSourceName([in] string SourceName, [in] string PackageID = "", [in] string SourceSite = "", [out] boolean IsDuplicated, [out] string DupPkgName = "", [out] string DupPkgID = "", [out] sint32 DupPkgType = 1); };
When I try to run the following snippet I get do not get an error and I also do not see any instances of "MYSMS_Class" using WMI CIM Studio or wbemtest.
public void CreatePackage(WqlConnectionManager connection) { try { IResultObject package = connection.CreateInstance("MYSMS_Package"); package["Name"].StringValue = "Test Package"; package["Description"].StringValue = "A test package"; package["PkgSourcePath"].StringValue = @"c:\Package Source"; package.Put(); } catch (SmsException ex) { Console.WriteLine("Failed to create package. Error: " + ex.Message); throw; } }
All Replies
-
Monday, January 30, 2012 3:14 AM
You might get a better responce if you post this to the SDK forum.
http://www.enhansoft.com/- Proposed As Answer by Garth JonesMVP Sunday, March 18, 2012 4:44 PM

