By Joseph Yedid
I needed to add some additional software (Psexec, BGInfo, and cmtrace) to all of my VMs. However, adding this software manually to each new VM would be a tedious task, so instead of doing it manually I decided to automate the process! As a bonus every new VM that gets created from this point on will automatically get this additional software via a package advertised through Configuration Manager.
To begin with, I needed to create a collection of only VMs to which I will deploy the package to.
I created a query based device collection targeting only VMs.
1. In the new device collection Wizard, give the collection name. Limit the collection to All Desktop and Server Clients. Click Next.
2. Click Add Rule and select Query Rule.
3. Give the query a name and then click Edit Query Statement…
4. Click the Star button to create a new query.
5. Click Select…
6. Set Attribute class to System Resource and Attribute to NetBIOS Name. Click OK.
7. Click OK.
8. Select the Criteria tab.
9. Click the Star button to add a new criteria.
10. Click Select…
11. Set the Attribute class to System Resource and Attribute to Virtual Machine. Click OK.
12. Click on Value… and select True. Click OK.
13. Click OK.
14. Click OK.
15. Set the schedule as you see fit. I have set my schedule to run every day to check for new VM clients. Click Next.
16. Click Next.
17. Click Close.
Once the collection was created, I needed to create the source folder to store the applications. In this case D:\Additional Software
Next, I needed to create a batch file which has the commands to copy my additional application software to their desired locations. The batch file will also be stored in the source folder. My batch file looks like this:
copy bginfo.exe c:\windows
copy bgconfig.bgi c:\windows
copy cmtrace.exe c:\windows
copy psexec.exe c:\windows
copy bgstartup.bat C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
Now in Configuration Manager, I created a package and program that will be deployed to the VM collection.
Once the package was created, I edited the package and specified it to contain the source files, which is the source folder.
Once added, click OK.
Then I needed to edit the program and added the batch file to the command line.
On the Environment tab, I set the program to run Whether or not a user is logged on and Run with administrative rights.
Now that that is all done, I was able to deploy the package. The batch file runs on the destination VMs and copies the files to their desired locations.
Every time a new VM is added to the collection, the package will be run and the programs will be installed. No more manual labor!
By Joseph Yedid