Tag Archives: Windows XP

Fixing WMI Service (root\cimv2 namespace missing)

I was working on a VBScript code that uses the Windows Management Instrumentation (WMI) to query the running processes on the local machine, something like this:

strComputer = "."
strProcess2Kill = "something.exe"
 
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process Where Name = " & strProcess2Kill)
 
For Each objProcess In colProcess
	'Now we will each one of the running processes "something.exe"
	objProcess.Terminate()
Next

This code works in, at least, Win2k, WinXP, WinVista and Win7 (not sure if works on WinNt 4). The problem I had (as you can see here) was that the box where it should have been deployed (Win2k) showed an 0x8004100E error (Namespace specified cannot be found) on the 4th line of the code.

When I ran the following script to query all the namespaces on root:

strComputer = "."
 
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root")
Set colNameSpaces = objSwbemServices.InstancesOf("__NAMESPACE")
 
For Each objNameSpace In colNameSpaces
 Wscript.Echo objNameSpace.Name
Next

I got this:

DEFAULT
SECURITY
WMI
directory
aspnet

As you can see, the CIMV2 namespace was not present and it should have been. So, something was wrong with the WMI installation on that box.

Then, I ran a very nice tool called wmidiag.vbs (pointed by user Uros Calakovic on my StackOverflow question) to diagnose several problems with WMI. Unfortunately, the tool gave me the same error and no proposed solution. He also mention a couple of interesting screencasts that more than one may find useful.

At the end, Google gave me the final answer once again. Reinstalling the WMI into the Windows Registry and rebuilding the WMI Repository did the trick (I did both, but maybe only the Repository rebuilding helped me this time).

In any case, to rebuild the WMI Repository, these are the only required steps:

  • Stop the WMI service (net stop winmgmt)
  • Go to %windows%/system32/wbem (in my win2k, winnt, on XP would be windows)
  • Rename or remove the repository directory
  • Start the WMI service again (net start winmgmt)

And for reinstalling WMI, you should run these commands on a console:

winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf

Install VirtualBox Guest Additions on Ubuntu Server

On my work, I have a box with WinXP, running Virtual Box as a host, and a Ubuntu Server 9.10 box as a guest. My problem is that the firewall on the corporate network does not allow Ubuntu to update the date and time against any NTP server (like pool.ntp.org or ntp.ubuntu.com). So, I need a way to keep the hour updated on the guest. Fortunately, VirtualBox has the ability to synchronize it from the host, the only thing I need to do was to install the Guest Additions package.

To do this, first, we need to click on Devices/Install Guest Additions (from the VirtualBox menu).

Then, on the Ubuntu Server, we install some pre-requisites:

$ aptitude install build-essential linux-headers-$(uname -r) -y

Now, we will mount the virtual CD-ROM (where the Guest Additions are):

$ mount /dev/cdrom /mnt/

And then, run the installer script (there is a 32-bit and 64-bit versions). For 32-bit (which is the most probable, as VirtualBox Open Source only supports 32-bit guests):

$ /mnt/VBoxLinuxAdditions-x86.run

Or for 64-bit guest:

$ /mnt/VBoxLinuxAdditions-amd64.run

It should install the available modules (like timesync), and drop a fail message saying that X server
was not found, which is OK as we are working with a server without GUI.

Finally, we umount the CD-ROM:

$ umount /mnt/

Now, the guest box time should be sync with the host, so we have one less thing to worry about.

Habilitar y deshabilitar la hibernación en Windows Vista

Aunque parezca tonto el título para quienes no lo han intentando, el proceso de habilitar o deshabilitar la funcionalidad de hibernar el equipo en Windows Vista es un poco más oscuro que el del Windows XP.

La única forma que he encontrado para hacerlo es utilizando la consola de DOS y ya no desde el panel de Opciones de Energía. Primero, se debe abrir la línea de comando con privilegios de administrador. Para esto, se hace clic en el botón Inicio, y en el campo buscar, se escribe cmd, pero en vez de presionar Enter, se debe presionar simultaneamente Ctrl + Shift + Enter. Luego de esto, aparecerá la ventana negra de la línea de comando y el título deberá contener el nombre Administrador. Luego, se procede a escribir el comando que habilitará la hibernación:

powercfg -h ON

Si lo que se busca es deshabilitarla, se deberá reemplazar el ON por OFF.

Windows Update no puede instalar actualizaciones luego de haber reparado una instalación de Windows XP

Hace poco cambie la mainboard de la PC de mi hermano por lo que tuve que reparar la instalación usando el disco de Windows XP. El problema de este método es que luego se tienen que volver a instalar todas las actualizaciones, incluidos los Services Pack que no estén en el disco que se haya usado.

Hasta ahí, todo bien. El problema vino al querer instalar las actualizaciones por medio del Windows Update. Cada vez que el Windows trataba de instalar las actualizaciones descargadas, mostraba un error en el que decía que algún programa en la computadora estaba interfiriendo con el proceso y la instalación fallaba. Después de googlear un rato el problema, encontré la solución en un artículo de la página de soporte de Microsoft. El problema es causado por una librería DLL que queda en el aire luego de reparada la instalación y que es necesaria para el funcionamiento del Windows Update. En el artículo se mencionan dos posibles soluciones, la que probé fue:

  • Descargar el instalador del Windows Update Agent de aquí (equipos x86).
  • Ir a inicio/ejecutar, hacer click en buscar, ubicar el archivo recién descargado y dar Abrir.
  • Agregar /wuforce al final del nombre del archivo y dar click en Aceptar.
  • Eso instalará el Windows Update nuevamente y solucionará el problema.