Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Launch command as administrator

Launch command as administrator

Scheduled Pinned Locked Moved C#
javascriptsecurityquestion
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jeremycafe1111
    wrote on last edited by
    #1

    I am trying to launch csript as an administrator (the account logged in has admin rights). setting the startinfo.verb to runas does not work.

    ProcessStartInfo p1 = new ProcessStartInfo();
    p1.UseShellExecute = true;
    p1.Verb = "runas";
    p1.FileName = "cscript";
    p1.Arguments = "I:\\WPKG\\wpkg.js /synchronize /quiet /nonotify";
    Process p = new Process();
    p.StartInfo = p1;
    p.Start();

    The only way I can get it to start with privileges is to manually set the username and password. However I cannot hardcode that information or put it into configurations. Is there any way to have the cmd elevate without the login info? I have also tried adding using (System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate()) around the above code with no luck either.

    L D M 3 Replies Last reply
    0
    • J jeremycafe1111

      I am trying to launch csript as an administrator (the account logged in has admin rights). setting the startinfo.verb to runas does not work.

      ProcessStartInfo p1 = new ProcessStartInfo();
      p1.UseShellExecute = true;
      p1.Verb = "runas";
      p1.FileName = "cscript";
      p1.Arguments = "I:\\WPKG\\wpkg.js /synchronize /quiet /nonotify";
      Process p = new Process();
      p.StartInfo = p1;
      p.Start();

      The only way I can get it to start with privileges is to manually set the username and password. However I cannot hardcode that information or put it into configurations. Is there any way to have the cmd elevate without the login info? I have also tried adding using (System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate()) around the above code with no luck either.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      There's a post[^] on the "Hey, Scripting Guy blog" that discusses running an elevated cscript.

      Bastard Programmer from Hell :suss:

      1 Reply Last reply
      0
      • J jeremycafe1111

        I am trying to launch csript as an administrator (the account logged in has admin rights). setting the startinfo.verb to runas does not work.

        ProcessStartInfo p1 = new ProcessStartInfo();
        p1.UseShellExecute = true;
        p1.Verb = "runas";
        p1.FileName = "cscript";
        p1.Arguments = "I:\\WPKG\\wpkg.js /synchronize /quiet /nonotify";
        Process p = new Process();
        p.StartInfo = p1;
        p.Start();

        The only way I can get it to start with privileges is to manually set the username and password. However I cannot hardcode that information or put it into configurations. Is there any way to have the cmd elevate without the login info? I have also tried adding using (System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate()) around the above code with no luck either.

        D Offline
        D Offline
        deanjott
        wrote on last edited by
        #3

        This might be a long shot but check this out. http://grubletrang.com/Software.aspx?app=PowerPrompt[^]

        1 Reply Last reply
        0
        • J jeremycafe1111

          I am trying to launch csript as an administrator (the account logged in has admin rights). setting the startinfo.verb to runas does not work.

          ProcessStartInfo p1 = new ProcessStartInfo();
          p1.UseShellExecute = true;
          p1.Verb = "runas";
          p1.FileName = "cscript";
          p1.Arguments = "I:\\WPKG\\wpkg.js /synchronize /quiet /nonotify";
          Process p = new Process();
          p.StartInfo = p1;
          p.Start();

          The only way I can get it to start with privileges is to manually set the username and password. However I cannot hardcode that information or put it into configurations. Is there any way to have the cmd elevate without the login info? I have also tried adding using (System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate()) around the above code with no luck either.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          What happens when you don't supply username and password?

          Mark Salsbery :java:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups