When you try to use the Control Panel / Add or Remove Programs applet in Windows Server 2003, you receive:

Setup Library wbemupgd.dll could not be loaded, or function OcEntry could not be found.
Contact your system administrator. The specific error code is 0x7e.

This problem will occur if Windows Server 2003 is having difficulty interpreting the PATH system environment variable.

I have scripted W2K3FixPath.bat to expand the %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem component of the PATH.

To verify that the path contains the %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem component, and NOT a corrupted string:

1. Open a CMD.EXE window.

2. Type the following and press Enter:

reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v PATH

3. If the %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem is NOT present, fix it manually.

NOTE: W2K3FixPath.bat uses SETENV.EXE.

W2K3FixPath.bat contains:

@echo off                              setlocal                              for /f "Tokens=2*" %%o in ('reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v path') do (                               set syspath=%%p                              )                              @echo %syspath%                              call set sys=%Syspath%                              @echo %sys%                              setenv -m PATH "%sys%"                              
You can manually expand the %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem component of the PATH to C:\Windows\System32;C:\Windows;C:\Windows\system32\Wbem, where C:\Windows is the folder where Windows Server 2003 is installed, and use Control Panel / System / Advanced / Environment Variables to change the PATH in the System variables.