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

Jerold Schulman

August 28, 2003

1 Min Read
ITPro Today logo

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:domainusername program.exe | sanur pa55w0rd    runas /u:domainusername 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:domainusername program.exe >&2 | sanur pa55w0rd



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.