Tag Archives: Troubleshooting

Could not load file or assembly TraceWrapper, Version=1.0.523.0

There are two versions of the TraceWrapper.dll in SCVMM install CD. One is x86 version and the other is x64 version. When you build your application on top of SCVMM library Microsoft.SystemCenter.VirtualMachineManager, it’s very important to pick up the correct version TraceWrapper.dll. In general, you should copy the 32 bit dll if you are using 32 bit system, copy 64 bit dll if you are using 64 bit system. Otherwise following BadImageFormatException would occur during runtime.

Could not load file or assembly ‘TraceWrapper, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

However, you should keep using 32 bit TraceWrapper on a 64 bit system for following scenarios:

  • You need debug your app in Visual Studio directly. In this case, process launched from Visual Studio debugger runs in WOW64 mode.
  • IIS is configured to run in 32 bit mode. In this case, all working processes run in WOW64 mode.

This is because in 64 bit windows, processes in WOW64 mode are 32 bit processes and can’t load 64 bit TraceWrapper.dll.

Manual Uninstall Windows Desktop Search

Here is how to uninstall Windows Desktop Search (WDS) as it is not visible in add-remove programs

Manual uninstall Windows Desktop Search 3

  1. Click on the Start Menu, then Run.
  2. Type cmd in the box and click OK. This will bring up the command line.
  3. Type the following and press enter

    %windir%$NtUninstallKB917013$spuninstspuninst.exe /q /promptrestart

  4. A box will now appear to confirm the WDS has been uninstalled and asks you to restart. Once you have restarted the PC WDS will be gone.

Continue reading

Access denied when creating a folder just deleted

I have a batch script which remove a folder and re-create it. The command that remove a folder is rd /s/q and the command create folder is mkdir. Recently I see something weird happening, everytime when the folder is deleted and re-created, there is error message Access is denied displayed. However, if I rerun the create folder command laer, it always pass successfully.

The explanation on http://support.microsoft.com/?id=159199 seems make sense,

This file is in a state known as pending deletion. This file has been deleted, but there are still handles open to it. NTFS will wait until all handles to this file are closed before updating the index. If an attempt is made to access the file, however, NTFS will deny the attempt. Because the file is listed in the index, but is effectively deleted, you can see the file but you cannot access it.

The workaround here is add a 60 seconds sleep between the folder deletion and folder creation operation.

Windows could not connect to the System Event Notification Service

If you see Windows could not connect to the System Event Notification Service error on VISTA, Windows server 2008, or Windows 7, you can try follow these steps to get it resolved.

  1. Click Start, click All Programs, and then click Accessories.
  2. Right-click on the Command Prompt and then select Run as Administrator.
  3. Once the Command Prompt has opened, type following command and then press ENTER.

    netsh winsock reset

  4. Close the Command Prompt and restart the machine.

File is Missing or Invalid Error Message

I frequently hit this on my Win7/Vista machines when I run executables that were built from VB6, the following error message appears:

Component ‘filename’ or one o its dependencies not correctly registered: a file is missing or invalid.

The problem is caused by a component or a dependency file used in this executable is not correctly registered or is missing from the system. The solution is copy the file from another computer that does not experience this problem and register it.

I wrote step by step instructions on how to resolve this problem in this post. It uses comdlg32.ocx as example but instructions also apply for other VB6 component file like richtx32.ocx, mscomctl.ocx, tabctl32.ocx and so on

Uncompress MSI File

Sometimes I need to unzip MSI file to view its content without actual installing it. I used to use a 3rd party tool named 7zip to extract MSI. Today I discover there is much easier way to do this with windows build in tool msiexec.exe

The use msiexec to uncompress MSI file, you need to open a command line and run type following:

msiexec /a <YourPackageFullPath> TARGETDIR=<ExtractedMSIFullPath>

Replace <YourPackageFullPath> with full path of MSI file, <ExtractedMSIFullPath> with the target folder you want MSI files to be extracted to.

For example, to extract c:setup.msi, run following command:

msiexec /a c:setup.msi TARGETDIR=c:ExtractedMSI

The uncompressed setup.msi and all files along with fold structures will be extracted into  c:ExtractedMSI

Note: For Vista/Win7 with UAC turn on, the above command needs to be run from elevated command prompt.

Register comdlg32.ocx on x64 Win7

Today when I run an old tool on my x64 Windows 7, following error message is displayed:

Component ‘COMDLG32.OCX’ or one of its dependencies is not correctly registered: a file is missing or invalid.

comdlg32.ocx missing error

Here is how to resolve comdlg32.ocx missing error.

  1. Download comdlg32.zip and extract comdlg32.ocx from zip file
  2. Move comdlg32.ocx to c:Windowssystem32 folder. For 64bit Vista/Win7, move comdlg32.ocx to c:WindowsSysWOW64
  3. Open a command line window and run following command:
    regsvr32 c:Windowssystem32comdlg32.ocx

    Note: a) On 64bit Vista/Win7, run this command instead:

    regsvr32 c:WindowsSysWOW64comdlg32.ocx

    b) For Vista/Win7 with UAC turn on, the above command needs to be run from elevated command prompt.

  4. Once comdlg32 is registered successfully, following message will prompt, DllRegisterServer in C:WINDOWSSystem32comdlg32.ocx succeeded.
  5. Now launch the application again you should not see file missing error.

Update: Important note if you use Windows 7: registering comdlg32.ocx must be done as administrator, or regsvr32.exe will fail with error 0x8002801c. To do this as administrator, Go to All Programs -> Accessories -> Command Prompt’, right click on ‘Command Prompt’ icon, and click on ‘Run as administrator’ to start a command prompt, then run the regsvr32 command

Find Computer Owner

At times people want to find out who owns a certain machine.

My Network places -> Search Active Directory -> Find: Computers, Enter Computer name: “FOOBAR”, Click “Find Now”, Select Result, Right Click “Manage” -> Local Users and Groups -> Groups -> Administrators -> (Find who is an admin on the box).

Another method is to open dsa.msc in MMC and Select “Advanced” View, then lookup computers and look at the Security tab.

The tool, srvinfo.exe, is also useful for learning info about a machine.