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.
This isn't quite as what you are looking for but have you had a look at using Powershell and SCCM to take some of the WMI pain away?
You might also want to look at:
There don't seem to be many Powershell cmdlets yet that provide the same level of functionality as Microsoft.SystemsManagementServer.Automation.dll but I did find PowerShell Community Extensions for Configuration Manager.