3

I have an application which needs to run with different user name.

I am trying to call "runas.exe" to call the batch file which calls my application.

When I tried this in command prompt it worked fine. One drawback is I have to provide password

I am wondering if this is possible as this runs on build sever without anyone intervention

Here http://blogs.msdn.com/b/oldnewthing/archive/2004/11/29/271551.aspx Microsoft explains why we cannot give password as command line parameter

I don't know what could be the better approach. Can anyone suggest any good alternative

I use Windows 2008 R2 64 bit

AlBlue
  • 23,254
  • 14
  • 71
  • 91
KK99
  • 1,971
  • 7
  • 31
  • 64
  • 1
    This answer http://stackoverflow.com/questions/98134/how-can-i-make-windows-software-run-as-a-different-user-within-a-script/98323#98323 might help, but CPAU makes no claim about Win 2008. – David J. Liszewski Nov 17 '11 at 14:35
  • Thanks. But I cannot use any tools like this. unfortunately – KK99 Nov 17 '11 at 14:39
  • 1
    May be this help you: http://stackoverflow.com/questions/783094/is-there-a-way-to-make-an-ant-task-run-as-administrator-in-windows-vista – Alex K Nov 17 '11 at 15:28
  • Thank you. But i just want to run as different user in domain which is not admin of the machine) – KK99 Nov 17 '11 at 15:31

1 Answers1

1

You can't do this, unless you write a small program which does this for you. Batch won't cut it for obvious security reasons.

A sample program that will work in windows xp can be found here.

FailedDev
  • 26,680
  • 9
  • 53
  • 73