-3

Pls am trying to run this code:

try{
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("netsh wlan show hostednetwork");
}
catch (Exception e){}

i then get this error:

You must run this command at an administrator privilege.

After several manipulations, it gave me this:

Supply an Administrator password.

which i dont have. pls how can i rectify this. thanks in advance

  • It looks like you understand the Java, Windows appears to be your problem. If you don't have admin priv on this box you are out of luck – Totoro May 01 '14 at 16:53
  • is it possible to bypass the UAC from my program? or allow my program to prompt the user for UAC, after which i will then use the output – user3052299 May 01 '14 at 17:16
  • That would negate the need for UAC. If this was *nix you could run your java setuid. Perfect call for a Windows StackExchange, perhaps SuperUser or ServerFault could help – Totoro May 01 '14 at 17:18

1 Answers1

1

You may want to try using Windows runas program. It allows you to execute command with authentication of another user.

This MSDN article contains neccesary information: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true

You may run runas without being prompted for password, but you'll have to type it in .exec() as plain text, or you may want to try to use keyboard-interactive authentication with runas.

Alexey Malev
  • 6,408
  • 4
  • 34
  • 52