In VB.net 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 VB.net that performs a simple system.io.file.copy(from mapped location, to program files location)
1)
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
securePassword.AppendChar(c)
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)
PPP.WaitForExit()
2)
proc.FileName = "runas"
proc.Arguments = "/env /userOMAIN\ADMIN USER NAME c:\temp\COPYRUNAS.EXE"
proc.WorkingDirectory = "C:\TEMP"
Process.Start(proc)
Can someone help?
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 VB.net that performs a simple system.io.file.copy(from mapped location, to program files location)
1)
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
securePassword.AppendChar(c)
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)
PPP.WaitForExit()
2)
proc.FileName = "runas"
proc.Arguments = "/env /userOMAIN\ADMIN USER NAME c:\temp\COPYRUNAS.EXE"
proc.WorkingDirectory = "C:\TEMP"
Process.Start(proc)
Can someone help?
My Computer
System One
-
- OS
- windows 7
- Computer type
- PC/Desktop
- System Manufacturer/Model
- self made