Regasm failing for administrator account

3.1k views Asked by At

Operating system: Windows XP Service Pack 3 Framework: Microsoft.Net\Framework\v2.0.50727

Command Prompt started as Administrator

<framework directory>\regasm /codebase Hps.Exchange.PosGateway.Client.dll /tlb
or
<framework directory>\regasm /codebase Hps.Exchange.PosGateway.Client.dll 

operating system returns:

RegAsm : error RA0000 : An error occurred while writing the registration 
information to the registry. You must have administrative credentials to 
perform this task.  Contact your system administrator for assistance

I do a set from the command prompt and it shows username=Administrator

Thanks Guys

2

There are 2 answers

2
Holistic Developer On BEST ANSWER

This might fail if for some reason you don't have the correct permission to the registry. This could be caused by a number of things, such as corporate policy or a virus/malware. Try resetting to the default using Solving setup errors by using the SubInACL tool to repair file and registry permissions.

The basic gist from that page (in case the link breaks in the future) is to download SubInACL and then run the following commands:

subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=YOURUSERNAME=f /setowner=administrators
subinacl /keyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=YOURUSERNAME=f /setowner=administrators
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators
subinacl /keyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators
subinacl /keyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators
subinacl /subdirectories %programfiles%\ /grant=administrators=f /grant=system=f /grant=users=e
subinacl /subdirectories %windir%\ /grant=administrators=f /grant=system=f /grant=users=e

However, I recommend visiting the linked page as it provides more details and caveats.

0
Dai Bok On

I have had the same problem here, I solved it by running the x86 version of regasm, instead of the x64, so in instead of

C:\Windows\Microsoft.NET\Framework64\v2.0.50727>regasm.exe

use

C:\Windows\Microsoft.NET\Framework\v2.0.50727>regasm.exe