After playing around with Server Core for a while I'm beginning to wonder how to perform certain administrative tasks. Today I found myself wondering about software management after reading a post on the Microsoft TechNet forums and decided to put my thoughts on paper.
Executables and MSI packages
Basically there are two dominant ways to install software to a Windows installation. The first way is through running an executable with an occasional command line switch. The second way is using MSI packages in combination with msiexec. MSI packages offer advantages, but the drawback is not all software is available as a MSI package.
To me the real difference between exe and msi files in regards to Server Core is how the information to uninstall the software is stored afterwards.
Add or remove programs
Again there are two ways to get information on the software that is installed onto your Server Core installation in absence of the "Add or Remove programs" Control Panel applet. (also known as appwiz.cpl)
The first way is by checking the registry keys underneath the following key:
Luckily Server Core offers regedit.exe and regedt32.exe to digg deep into the registry of our Server Core box. Actually the "Add or Remove programs" Control Panel applet checks these registry keys at well. Since we all know how long it takes to get a complete list of all the software on your windows box it's obvious this method takes a lot of time.
As this TechNet page points out the software packages that are listed underneath the Uninstall registry key all have a registry value associated with the UninstallString. You can use this value as a command to uninstall the software.
An easier way to check which software packages were installed is using the Windows Management Instrumentation Console:
This returns the information on the packages installed using the MSI installer. This however might not be all the software installed on your box. It's a fast way, but obviously not very thorough. The output represents the MSI packages. Using the MSI packages and the uninstall command line switch you can uninstall packages.
When your specifically searching for drivers that are installed for your systems hardware you can use the following command line:
Sc query type= driver
Uninstalling a driver is not a very likely scenario, but you can uninstall drivers using:
pnputil -d -f package.inf
According to this TechNet page this will remove the package from the driver store. restarting the server will result in the same scenario before you actually added the driver to the system. (I can think of scenarios where this might be a good thing)
Checking for Windows Updates on Server Core is a whole other ball game, for which I recommend using the following command line:
Removing a Windows Update is easy as well, since the above command line outputs values that you can use in the following command line:
There are two main ways of installing software on your Server Core box. There are also two ways of checking for installed software and removing them.
Digging through the registry might not be the most efficient way to check for installed software and find the removal strings.
I suspect the Server Core team might find it useful to supply us with some software removal option inside SCregEdit.wsf. Using a third party (freeware) tool like Revo Uninstaller or MyInstaller and their possible attack surfaces from my point of view should not be a part of the Server Core strategy.
Windows Installer: Benefits and Implementation for System Administrators
WMIC – Take Command-line Control over WMI
Command-Line Switches for the Microsoft Windows Installer Tool
Windows Server 2008 – Uninstall or Reinstall a Device
Uninstall Registry Key (Windows)
MyUninstaller – alternative to Add or Remove Programs
Why did the Add or Remove Programs control panel try to guess all that information?
Remotely Deleting a Program Listed in Add/Remove Programs
(Add or) Remove Programs
Remove program from Add/Remove program lists
Remove Programs in Bulk with Absolute Uninstaller
The Brutal Inefficiency of MSIEXEC
MSI Gurus – Command-Lines
Executing MSI From Command Prompt
Disclaimer Beta Software
The information on this webpage applies to software from Microsoft that was in testing phase but utilizable by experienced users by the time the webpage was written. This software has not been released for sale, distribution or usage for the general public. The information on this webpage and the beta software are provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose.