Regasm.exe from command line RRS feed

  • Question

  • Hi there

    In my batch file i have the following code

    %1 having a parameter as serverA

    for %%x in (\\%1\c$\test1\entities\*.dll) do
    \\%1\c$\WINDOWS\system32\regsvr32.exe /s %%x >>"file.log"

    \\%1\c$\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "\\%1\c$
    \test1\entities\function.dll" /codebase >>"file.log"

    2 questions really

    On the file.log i'm not getting any information displayed about those
    vb6.dlls that are registered. how do i go about getting this written

    My second question is when i try to register function.dll which is
    a .NET dll using the regasm.exe i get Flags="Unmanaged Code" error.
    Not sure whether this is a .NET error or a DOS syntax error. can u
    please advice?


    Wednesday, December 16, 2009 7:17 PM


All replies

  • The batch code above runs locally, not on the server, right?
    If you need to find out what's wrong, as the first step avoid using server path and batch files, run commands locally (on local disk) and directly from command line. That will remove unrelated noise.

    1) Is VB6.dll registered locally? What does the command 'regsvr32.exe /s vb6.dll' do then? (Paste the output here)
    2) What exactly is the error/output? (Paste it here with the command line)

    Wednesday, December 16, 2009 10:22 PM
  • The batch file seems to work locally but i wanted to write a batch file which can be run from anywhere.
    So in this case the batch files are not run locally.

    I have entered an extra command to shout once VB6.dlls are registered.

    for %%x in (\\%1\c$\test1\entities\*.dll) do
    \\%1\c$\WINDOWS\system32\regsvr32.exe /s %%x >>"file.log"

    Echo VB6 Dlls Unregistered. Script will now unregister .NET dll..........

    \\%1\c$\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "\\%1\c$
    \test1\entities\function.dll" /codebase >>"file.log"

    where --> %1 having a parameter as serverA

    I'm not able to paste the output as i can't see what's happening. How do i get this onto a file log to confirm whether Vb6.dlls are actually registered?

    For the Regasm.exe error,error i get is as follows i.e

    Unhandled Exception: System.Security.SecurityException: System.Security.Permissi
       at Microsoft.Tools.RegAsm.RegAsm.Run()
       at Microsoft.Tools.RegAsm.RegAsm.Main(String[] aArgs)
    The type of the first permission that failed was:
    The demand was for:
    <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Ve
    rsion=, Culture=neutral, PublicKeyToken=<serial number omitted purposefully here>"

    The Zone of the assembly that failed was:

    Thursday, December 17, 2009 10:47 AM
  • \\AnotherComputerName\c$\WINDOWS\system32\regsvr32.exe will run locally regsvr32.exe from the share. It doesn't run it on AnotherComputerName!

    You will have to find correct method for running batch files/commands on remote computers. (Check out the internet - it is beyond the scope of this forum)

    The output you are getting is expected.

    Thursday, December 17, 2009 4:41 PM
  • Thanks Karel
    Thursday, December 17, 2009 5:00 PM
  • hello

    I have the same problem when registering a dll created in vb. net, and I need to register on a local computer, the dll is in a remote computer, but I have the same security error when using the Regasm, can you help me?

    Wednesday, June 23, 2010 10:36 PM
  • Copy the DLL to local computer and register it locally.


    Thursday, June 24, 2010 3:56 PM