views:

1690

answers:

4

I'm using a build script that calls Wise to create some install files. The problem is that the Wise license only allows it to be run under one particular user account, which is not the same account that my build script will run under. I know Windows has the runas command but this won't work for an automated script as there is no way to enter the password via the command line.

+2  A: 

This might help: Why doesn't the RunAs program accept a password on the command line?

JW
Not really :P but it is sad that that is the top google result. Here's hoping this will displace it!
Luke
Except that the page in question is the top result for a good reason.
Kris Kumler
A: 

It's a bit of a workaround solution, but you can create a scheduled task that runs as your user account, and have it run regularly, maybe once every minute. Yes, you'll have to wait for it to run then.

This task can then look for some data files to process, and do the real work only if they are there.

jfs
+2  A: 

I recommend taking a look at CPAU.

Command line tool for starting process in alternate security context. Basically this is a runas replacement. Also allows you to create job files and encode the id, password, and command line in a file so it can be used by normal users.

You can use it like this (examples):

CPAU -u user [-p password] -ex "WhatToRun" [switches]

Or you can create a ".job" file which will have the user and password encoded inside of it. This way you can avoid having to put the password for the user inside your build script.

Jeffrey Vanneste
A: 

This might help, it's a class I've used in another project to let people make their own accounts; everyone had to have access to the program, but the same account couldn't be allowed to have access to the LDAP stuff, so the program uses this class to run it as a different user.

http://www.codeproject.com/KB/dotnet/UserImpersonationInNET.aspx

Asmor