dcsimg
Results 1 to 7 of 7

Thread: [RESOLVED] regsvr32.exe as admin

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2014
    Posts
    249

    Resolved [RESOLVED] regsvr32.exe as admin

    I have this statement in VB.Net application:
    Code:
    Shell("Regsvr32.exe /s " & """" & strDestination & """")
    where strDestination is the DLL file which is loaded from server and registered.
    It is required if some new DLL is added to the project and either required to create a new setup, run it on all workstations or just register it automatically.
    It use to work for years with no problem and registered at least 10 added DLLs. Last added DLL was successfully registered on about 100 machines and failed on 3. When I tried to register manually using RUN regsvr32.exe & path to the file I've got a message
    Name:  DLL_Problem_2.jpg
Views: 278
Size:  75.4 KB
    Google suggested to register via cmd as admin. That registration was succesful. Probably something different with Windows security settings. I would like to avoid this issue in future.
    How should my statement be changed to run regsvr32 as admin?

    Thank you

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    21,824

    Re: regsvr32.exe as admin

    Here's a Process.Start solution. To run as administrator, use .Verb = "runas"

    https://social.msdn.microsoft.com/Fo...forum=netfxbcl

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2014
    Posts
    249

    Re: regsvr32.exe as admin

    Where do I insert "runas" ? Would you please give the sysntax.
    Thank you

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    21,824

    Re: regsvr32.exe as admin

    Code:
    Dim p As New Process()
            p.StartInfo.FileName = "regsvr32.exe"
            p.StartInfo.UseShellExecute = False
            p.StartInfo.Verb = "runas"
    
            Try
                p.StartInfo.Arguments = " /s " & """" & strDestination & """"
                p.Start()
            Catch ex As Exception
                 throw new Exception("The following DLL did not register." + _
                                     Environment.NewLine + strDestination + Environment.NewLine + "Reason:" + Environment.NewLine + ex, ex.InnerException)
            End Try

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2014
    Posts
    249

    Re: regsvr32.exe as admin

    Thank you very much. I'll try

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2014
    Posts
    249

    Re: regsvr32.exe as admin

    It worked. Thanks a lot again.

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,783

    Re: regsvr32.exe as admin

    Please use the Thread Tools menu to mark your thread Resolved if it is indeed resolved.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width