I am currently using provisioning to build new machines and eventually to re-build existing machines. A major advantage of using provisioning is the ability to make use of hardware independent imaging which in turns reduces the number of images that need to be maintained. We have a requirement that dictates that all laptop/netbook/notebooks automatically have an item of software installed on them as part of the provisioning process. In keeping with the benefits of provisioning, I do not want to have a template for laptops and a template for desktops. Instead I was hoping to distinguish between a laptop and a desktop and then carry out the necessary action based on the device type.
Initially I planned to do this as a pre-requisite query which would return only laptops so that the software could not be deployed to a desktop. However it appears that pre-requisite queries are evaluated when the template is loaded and at this point only a miniscan would have been sent to the inventory.
My idea was to make use of a few scripts. I wrote an AutoIT script to query WMI to ascertain the device type. If the device type was a desktop a .txt file was written to the root of C. The aim was to then use that file as detection logic for the software package. The SWD package was made up of the following:
Main package: DeleteFile.exe
The DeleteFile.exe would simply delete the ldDetection.txt file once the software has been successfully installed.
Dependent Package 1: WMIQuery.exe
This.exe would run a WMI query to ascertain the device type. If the device was a desktop ldDetection.txt file is written to the root of C. If the device is a laptop the program exits without doing anything.
Dependent Package 2: setup.exe
This .exe would be the software setup files. Detection logic is configured within the package so that the software will not run if ldDetection.txt at C:\
This method worked, but following testing I was ready to implement my work around only the issue arose when I discovered the setup file comes as an .MSI and of course with an .MSI SWD there is no opportunity to enter detection logic.
Has anyone found a work around to such a scenario? Should the detection logic be inside the .MSI? I was hoping to keep all logic external from the .MSI.
Any ideas would be greatly appreciated.