Dim pi As New System.Diagnostics.ProcessStartInfo()
pi.FileName=(ipchangepath)
pi.RedirectStandardError = True
pi.RedirectStandardOutput = True
pi.Verb = "runas"
pi.CreateNoWindow = true
pi.UseShellExecute =False
Dim p As process=Process.Start(pi)
My.Computer.FileSystem.WriteAllText(errorpath, p.StandardOutput.ReadToEnd(), True)
My.Computer.FileSystem.WriteAllText(errorpath, p.StandardError.ReadToEnd(), True)
I am trying to run a batch file from my vb.net application but it requires administrator privileges to run.
I tried the above code but the error shows that it needs to be run as administrator
C:\Users\JONAH\Documents\SharpDevelop Projects\LinkIt\LinkIt\bin\Debug>netsh interface ip set address name=Wi-Fi source=static addr=10.10.118.161 mask=255.255.254.0 gateway=10.10.116.25 gwmetric=0
The requested operation requires elevation (Run as administrator).
C:\Users\JONAH\Documents\SharpDevelop Projects\LinkIt\LinkIt\bin\Debug>netsh interface ip set dns "Wi-Fi" static 10.10.116.5
The requested operation requires elevation (Run as administrator).
C:\Users\JONAH\Documents\SharpDevelop Projects\LinkIt\LinkIt\bin\Debug>netsh interface ip add dns "Wi-Fi" 202.200.100.95 index=2
The requested operation requires elevation (Run as administrator).