Deploying Applications Based Upon Add/Remove Programs History – Using Microsoft Deployment Toolkit with SMS/SCCM
The documentation in the MDT toolkit is pretty good, but I did need to change the query to suite my needs. The default query uses ProdID0 in the database, i found that DisplayName0 makes a lot more sense, since that is what you actually "see" when you look at the ARP in Control Panel.
Also to note, that i've found it's a good idea to always make sure you specify your SQLShare property for all your database sections in your customsettings.ini, it's also a good idea to use a differen share from your logs, i just use a generic SQL$ share that isn't linked to anything else. Otherwise I've seen some errors on the logs because another process owns that share.
So your new stored procedure in the MDT database would be:
CREATE PROCEDURE [dbo].[RetrievePackages]
@MacAddress CHAR(17)
AS
SET NOCOUNT ON
/* Select and return all the appropriate records based on current inventory */
SELECT * FROM PackageMapping
WHERE ARPName IN
(
SELECT DisplayName0 FROM DATABASE.dbo.v_GS_ADD_REMOVE_PROGRAMS a, DATABASE.dbo.v_GS_NETWORK_ADAPTER n
WHERE a.ResourceID = n.ResourceID AND
MACAddress0 = @MacAddress
)
GO
NOTE: Changed ProdID0 to DisplayName0, information returned from ProdID0 was not was I was looking for
Here is the required information needed in your customsettings.ini
Priority=DynamicPackages
[SMS]
SQLServer=SERVER
Database=SMS DATABASE
Table=v_Program
Parameters=PackageID,ProgramName
SQLShare=SQL$
NetLib=DBNMPNTW
[DynamicPackages]
SQLDefault=DB_DynamicPackages
[DB_DynamicPackages]
SQLServer=SERVER
Database=MDT DATABASE
StoredProcedure=RetrievePackages
Parameters=MacAddress
SQLShare=SQL$
NetLib=DBNMPNTW
Here is an example of the PackageMapping table:
The nice thing about the package mapping is that you can control what is being installed. So if you want to install Adobe Reader 9, you create a mapping for any possible old version and say, Reader 9 is the new version. So you can “map” Reader 7,8 to Reader 9. So if their ARP report shows Reader 8 installed, you can tell it to install Reader 9 instead after the refresh.
The one bad thing about package mapping is that i doesn’t know about licensing. It’s also entirely based upon the DisplayName, so if you have a trial version of something that shows up the same as a licensed version, if you map that in the table, someone who had a trial version will now have a licensed version installed. Just something to keep in mind.
If you have any questions, feel free to contact me... I’ve also attached the documentation taken from the MDT 2008 reference material.