Welcome to Dirteam.com/ActiveDir.org Blogs Sign in | Join | Help

The things that are better left unspoken

a blog by Sander Berkouwer

Related

AD Manager Plus
 

Blog roll

News



Archives

Add or Remove programs in Server Core

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)

Registry

The first way is by checking the registry keys underneath the following key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall

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.

WMI

An easier way to check which software packages were installed is using the Windows Management Instrumentation Console:

wmic product

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.

Drivers

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)

Windows Updates

Checking for Windows Updates on Server Core is a whole other ball game, for which I recommend using the following command line:

wmic qfe

Removing a Windows Update is easy as well, since the above command line outputs values that you can use in the following command line:

Wusa.exe patchname.msu

 

Concluding

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.

Further reading

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.

Posted: Monday, August 27, 2007 11:08 PM by Sander Berkouwer

Comments

Ask the Directory Services Team said:

Previously I had mentioned the Server Core Step-by-Step Guide that does a great job of giving you the command-line equivalents for common admin tasks. One thing it does not cover is how to uninstall applications from Server Core, but I did come across this blog on the subject. Under the covers when you uninstall a program, the Add/Remove Programs (XP/2003) and Programs & Features (Vista/2008) control panel applets are just running whatever is specified in the UninstallString registry value under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, so on Core installs of Server 2008 where those control panel applets do not exist, you just find that registry value and run the command it specified from the command-line. Be sure to check out the Server Core blog for other tips on Server Core.

# February 22, 2008 3:30 PM

TrackBack said:

Quoted from a blog by Sander Berkouwer
# June 2, 2008 12:48 AM

Add or Remove programs in Server Core | Michael Phillips Blog said:

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)

# April 1, 2009 8:25 PM

markwilson.it » Injecting network drivers into a Hyper-V Server (or Windows Server) installation said:

A couple of weeks ago, I blogged about running Windows from a flash drive - specifically running Hyper-V Server 2008 R2. One thing I hadn’t got around to at that time though was injecting the necessary drivers to provide network access to/from the server - which is pretty critical for a virtualisation host! Under network settings, the Hyper-V Server Configuration (sconfig) showed that there were no active network adapters found but I knew this should be pretty easy to fix.
# August 6, 2009 3:15 PM

Uninstall Server Core Installed Application - Charles L'Abri Anderson | Charles L'Abri Anderson said:

I wanted to remove an installed app from my server core, and it came to my attention: I’ve got no idea how to really get this done!

So, the short of it- its pretty simple. I wanted to remove a barracuda backup agent, and so I used the Regedit method.


Thanks to Sander Berkouwer for the info.

# April 2, 2012 7:26 PM
Anonymous comments are disabled