Windows 8 and 8.1 Forums

runas in

  1. #1

    Posts : 2
    windows 7

    runas in

    In I wrote an installation program that periodically needs updating.
    The first installation must be done by an administrator in order to create program files folders and register DLL's etc..
    But I need to make updates to the program every once in a while requiring the user to simply copy a file located on a mapped network drive to a location in program files.
    Normal Users cannot make this simple copy so I want to be able to supply a domain administrator's username and password (from an encrypted database) to just make the copy.

    I have tried the following two programs without success
    copyrunas.exe is a program I wrote in that performs a simple mapped location, to program files location)

    Dim startInfo As New ProcessStartInfo()
    startInfo.FileName = "copyrunas.exe"
    startInfo.Arguments = ""
    startInfo.WorkingDirectory = "c:\temp"
    Dim PW As String = "domain admin password"
    Dim securePassword As New Security.SecureString()
    For Each c As Char In PW
    Next c
    startInfo.UserName = "DOMAIN ADMIN USERNAME"
    startInfo.Password = securePassword
    startInfo.Verb = "RUNAS"
    Dim USERX As String = System.Security.Principal.WindowsIdentity.GetCurrent.Name
    startInfo.Domain = USERX.Substring(0, USERX.IndexOf(""))
    startInfo.UseShellExecute = False
    startInfo.CreateNoWindow = True
    Dim PPP As Process = System.Diagnostics.Process.Start(startInfo)

    proc.FileName = "runas"
    proc.Arguments = "/env /userOMAIN\ADMIN USER NAME c:\temp\COPYRUNAS.EXE"
    proc.WorkingDirectory = "C:\TEMP"

    Can someone help?

      My System SpecsSystem Spec

  2. #2

    See if this helps:

    Also use Folder.Copyhere instead - it has overwrite/silent switches if that's required.
      My System SpecsSystem Spec

  3. #3

    Posts : 2
    windows 7

    runas in


    Just a note
    I could get access to the mapped drive and was unable to re-map the drive in impersonate mode so before I impersonated the administrator I copied the file from the mapped share to a local folder then used the impersonate mode to copy from the local file into the program files folder I needed.

      My System SpecsSystem Spec

runas in
Eight Forums Android App Eight Forums IOS App Follow us on Facebook