shell a program as administrator
-
Wednesday, March 03, 2010 6:21 PM
I am writing a setup program that runs as administrator. If I shell a program from the setup program will it also run as administrator?
All Replies
-
Wednesday, March 03, 2010 6:28 PMYes.
Just trying to find the documentation that explains this.
Can't find the documentation but a quote here supports this....
http://www.vistax64.com/vista-account-administration/232825-uac-run.html
"That and the administrative token is inherited by child processes of
that parent. However, subsequent processes created by the limited user
account do not run elevated."
Go and try it out! - :-) -
Wednesday, March 03, 2010 7:37 PMI'll give it a try. Thanks for your help!
-
Wednesday, March 03, 2010 7:38 PM
I am writing a setup program that runs as administrator. If I shell a program from the setup program will it also run as administrator?
Is this a VB.NET or VBScript ?
In vb.bet, you can use processinfo and set the verb to runas
Dim process As System.Diagnostics.Process
Dim processStartInfo As System.Diagnostics.ProcessStartInfo
processStartInfo = New System.Diagnostics.ProcessStartInfo
processStartInfo.FileName = "regedit.exe"
If System.Environment.OSVersion.Version.Major >= 6 Then ' Windows Vista or higher
processStartInfo.Verb = "runas" "
Else
' No need to prompt to run as admin
End If
processStartInfo.Arguments = ""
processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal
processStartInfo.UseShellExecute = True
process = System.Diagnostics.Process.Start(processStartInfo)
For VBscript, go to its forum http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.scripting.vbscript
kaymafCODE CONVERTER SITE
- Marked As Answer by Martin_XieModerator Thursday, March 11, 2010 3:42 AM
-
Wednesday, March 03, 2010 7:48 PMI'm using VB6 and modifying the setup code.
-
Wednesday, March 03, 2010 7:52 PM
I'm using VB6 and modifying the setup code.
Try vb6 forum for this issue : http://www.vbforums.com/forumdisplay.php?forumid=1
kaymafCODE CONVERTER SITE
-
Thursday, October 28, 2010 4:30 PM
Please, help me too.
I'm using this code:
Dim comando As String = "REG ADD " & Chr(34) & tx_chave.Text & Chr(34) & " /v " & tx_sequencia.Text & " /d " & Chr(34) & tx_Cooperativa.Text & Chr(34) & " /f"
Shell(
"cmd.exe /c " & comando)
' comando = REG ADD "HKLM\SOFTWARE\Citrix\ICA Client" /v ClientName /d "NAME" /f
But on Windows Seven or Vista it's doesn't work becouse needs run the shell like administrator. How can i do that?

