SMS 2003 contained a great feature for automation via the excellent dll: Microsoft.SystemsManagementServer.Automation.dll. It allowed automating SMS using intuitive objects, properties and methods such as:
SMSProvider.Packages.Create("NewPackage");
In SCCM 2007, it seems this great dll has been deprecated in favor of more WMI style "dog's breakfast" code:
var conn = new WMIConnection(@"\\Server\root\sms\site_a", usr, pass);
var queryResults = conn.ExecuteQuery("SELECT * FROM SMS_Package WHERE
Name='" + packageName + "'");
foreach (ManagementObject obj in queryResults)
{
packageID = (string)obj.GetPropertyValue("PackageID");
}
I am tempted to write my own skeleton classes around these wmi calls. All that seems needed for basic automation would seem to be: SccmServer, SccmPackage, SccmProgram and SccmTaskSequence.
The question is: does anyone have wrapper, skeleton classes like this available, or know of any open source projects that I can use or adapt? I hate reinventing the wheel for mundane stuff like this.