Skip navigation

JSI Tip 7111. Sanur freeware allow you to script RunAs.

When you use the RunAs utility, it prompts for a password, unless you can live with the solution I described in tip 3063.

To workaround this behavior, download and unzip Sanur.zip, a tiny Win32 console utility that pipes a password into the Windows 2000/XP/2003 Runas utility, making RunAS scriptable.

When you type sanur /? at a CMD prompt, it displays:

SANUR v1.0 Win32 Commandline RUNAS Automation Utility for 2000/XP/2003.
Copyright (c) 2001-2003 Ritchie Lawrence, http://www.commandline.co.uk.

  RUNAS  | SANUR password
  RUNAS  | SANUR /i \[drive:\]\[path\]filename

  /i    Pipes the password from the specified file into RUNAS.

  Example usage:-

    runas /u:domain\username program.exe | sanur pa55w0rd
    runas /u:domain\username program.exe | sanur /i password.txt

  Note: As Runas uses stdout to show errors, I recommend stdout is redirected
  to stderr using >&2. This does not affect the program started by Runas. Eg:-

    runas /u:domain\username program.exe >&2 | sanur pa55w0rd



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish