1E has customers which have asked about utilizing Shopping in order to provision a ConfigMgr Maintenance Window. This document will discuss one method whereby 1E Shopping can be used to provision a ConfigMgr Maintenance Windows by leveraging the new Workflow Integration feature of Shopping 3.2 and Discovery Data Records as discussed in the Configuration Manager 2007 SDK.
The overall concept is to utilize the Shopping THIRDPARTYAPPREF field that is available on all 1E Shopping Applications to generate a DDR record in ConfigMgr. The THIRDPARTYAPPREF value is designed as a unique reference for interfacing with other third party tools. When a user shops for an application 1E Shopping can be configured to initiate a workflow (aka script) which is called on completion of various events. In this scenario the script is configured to assign a specific attribute for example:“MW1-00001” to each client within ConfigMgr. Shopping is able to perform this task because shopping knows the relevant details (SMSGUID,SITE,NAME) of each client computer within the ConfigMgr server due to the ActiveX control (Shopping Probe) where the client computer is assigned therefore we can re-use this information as an automation method to create a DDR record. The result is an attribute assignment that can be utilized as a basis for collection memberships within ConfigMgr 2007 infrastructure and is completely independent of the existing Shopping managed collections or advertisements.
In addition standard shopping authorization and access and approval models apply which is to say that end-users and administrators will to have access to these Maintenance Windows packages as defined by normal shopping computer categories or user categories or by approvals if desired.
These are the requirements which were stated around the self-service shopping for Maintenance Windows.
This solution has the following requirements.
In order to implement this solution you must have the following components installed.
The ConfigMgr 2007 SDK is required in order to generate a DDR for client computers within ConfigMgr 2007. This is process to register the dll named above.
The following is an example of how to create a shopping application for end-users to provision a Maintenance Window of their choice. This example will be used in the subsequent section to build a collection in ConfigMgr.
*Note* The key element above is the Application Ref: “MW1-D0001”
These are the properties that control the computer systems that are members of this specific Maintenance Window collection.
The script below would replace the default ApprovalProcessCompleted.vbs script in Shopping.
'this script was written as a demo to provision Maintenance Window in ConfigMgr' using 1E Shopping 'Author: Richard Fellows @ 1E ' '------------------------------------------------------ ' version 1 '------------------------------------------------------ Const ADDPROP_NONE = &H0 Const ADDPROP_FULLREPLACE = &H1 Const ADDPROP_GUID = &H2 Const ADDPROP_KEY = &H8 Const ADDPROP_NAME = &H44 Dim strConfigMgrServer, strMW Dim DDR, strComputer, strSiteCode, strGUID Dim Logfile, objFS, intLogsize, strLogfile, strScriptName, oFile, strOldLogFile strSiteCode = "%SITE%" 'lookup to copy DDR to the correct site Server based on client assigned site if strSiteCode = "CFM" then strConfigMgrServer = "OHWANCFM4401" '------------------------------------------------------ 'variables replaced by the ShoppingCentral service account prior to execution of the script. '------------------------------------------------------ strComputer = "%MACHINENAME%" strMW = "%THIRDPARTYAPPREF%" strGUID = "%GUID%" if Len(strMW)<>9 Then Wscript.quit 'if the length of THIRDPARTYAPPREF is NOT 9 skip it if UCase(Left(strMW,2)) <> “MW” then Wscript.quit 'if the THIRDPARTYAPPREF does not begin with “MW” then skip it '------------------------------------------- ' create an object for generating SMS DDR's '------------------------------------------- Set DDR = CreateObject("SMSResGen.SMSResGen.1") GenerateDDR strComputer,strConfigMgrServer,strSiteCode,strMW,strGUID '------------------------------------------------------ ' this is the function that does the DDR generation and copies it to the ConfigMgr Site Server '------------------------------------------------------ Function GenerateDDR(strComputer,strConfigMgrServer,strSiteCode,strMW,strGUID) 'Build the DDR DDR.DDRNew "System", "Maintentance Window", strSiteCode DDR.DDRAddString "Name", strComputer, 25, ADDPROP_NAME DDR.DDRAddString "Maintenance Window", strMW, 9, ADDPROP_NONE DDR.DDRAddString "SMS Unique Identifier", strGUID, 64, ADDPROP_GUID And ADDPROP_KEY 'Now write the DDR to the site server ' *note* in this next line of code files can be written locally to a folder on the shopping server as well for backup purposes. 'DDR.DDRWrite "C:\" & strSiteCode & "_" & strComputer & ".ddr" DDR.DDRWrite "\\" & strConfigMgrServer & "\SMS_" & strSiteCode & "\inboxes\auth\ddm.box\" & strSiteCode & "_" & strComputer & ".ddr" ' *Note* it would be nice if we could monitor ConfigMgr to a status message when the DDR is 'processed as well ' ---maybe for a future release? --- ' Additional work: Customer may want to implement a restriction on how often the customer 'can shop for a Maintenance Window example if the last DDR was created less the xx days ago. 'Discard the request and notify the customer via email End Function