runas

C#: Load roaming profile and execute program as user

In an application I need to execute other programs with another user's credentials. Currently I use System.Diagnostics.Process.Start to execute the program: public static Process Start( string fileName, string arguments, string userName, SecureString password, string domain ) However this function does not load the roam...

Run new process as different user in vb.net

I'm currently using a homegrown method to run a process as a different user in Vista, and I can't escape the feeling that's it hack-ish and less than ideal (in addition to the fact that it craps out UAC, crashing my app with a security exception, and forcing me to disable UAC altogether). My process consists of two projects (so two EXE f...

Getting "The RUNAS command is not supported." when using runas on iexplore.exe

When attempting to run IE on Windows Server 2008 under different user accounts using the runas command I get the message "The RUNAS command is not supported." This command works fine for other applications, but not for IE. Anyone else run into this & find a workaround? ...

SysTray Icon not visible after restart for a program running as administrator.

I have a simplest form of an application, in which I am showing a SysTray Icon and adding the application in Startup items. Application is developed in C#. I want tray icon to be shown even after restart of the machine. Currently, I am facing a strange behavior while running the exe using "Run as Administrator". When I use under administ...

How to build RUNAS /NETONLY functionality into a (C#/.NET/WinForms) program?

Our workstations are not members of the domain our SQL Server is on. (They're not actually on a domain at all - don't ask). When we use SSMS or anything to connect to the SQL Server, we use RUNAS /NETONLY with DOMAIN\user. Then we type in the password and it launches the program. (RUNAS /NETONLY does not allow you to include the pass...

How do I start an out of process COM server as another (more privileged) user

I would like to create a COM object that runs in an out of process COM server as another user. How do I do that? I have control over the COM server source code and my COM client is the only one that will be creating these COM objects. ...

Using Run As to run multiple instance of IE 8 doesn't seem to work

In the past, I've used the runas commandline to launch another instance if IE on a secondary account for testing, since our in-house web-app application uses windows authentication to identify a user. With the new multi-process model if IE8, this doesn't seem to work. Has anyone seen a workaround for it? ...

Win7 runas command: How to capture output of command that is run?

I'm trying (under Windows 7) to use the runas command to stop then restart a service. (Win7 requires admin privs to do this; thus the use of runas.) Stopping the service works fine, but starting it does not. Here's the command I'm using for stopping the service: runas /user:myDomain\myUserId "net stop serviceName" Here's the command ...

CreateProcessWithLogonW and mmc.exe

Hi! I wrote a program, that should work like RunAs. It works fine, but i have one problem with it. If i want to run for example compmgmt.msc, then i should run mmc.exe and compmgmt.msc as it's parameter. Computer Management will open, but not under the user as i want to run it. It will run under that username who is logged in. Can someo...

ShellExecute + runas with quotes (") in parametees, fails to call the executable/batch

I have tried calling a batch file with elevated permissions. For that I have called fallowing function: (ref - http://msdn.microsoft.com/en-us/library/bb762153%28VS.85%29.aspx) ShellExecute(this->GetSafeHwnd(), L"runas", strExecutable, strParams, 0 , SW_SHOW); The call successfully launches the exexutable, but if I add quotes to my par...

Jboss5, unauthenticated calls to secured EJB via @RunAs

I'm attempting to call methods on a secured EJB from an unauthenticated source (a Message Driven Bean hooked up to a queue). The MDB has an EJB injected into it via @EJB, which is fine, but the target EJB has @SecurityDomain("stuff") and @RequireRole("user"), and on execution generates huge stack traces around: 17:14:03,275 ERROR [STD...

RanAs - LocalNetwork, LocalService, LocalSystem

Hello, How can I run some exe, bat,cmd application under this buildin accounts, is it possible? ...

Connect w/ Sql Server Management Studio to an domain server using domain credentials

Hi there, I have a machine that's not connected to a domain and I want to connect to server in that particular domain and I do have proper credentials to log on. I used runas command as follows: runas /netonly /user:domain\domain_username ssms.exe and I was able to connect to the server which otherwise I could not. The weird thing is...

Windows Installer/RunAs shortcut

I have an application on a server in our domain; it's written in C# and uses the Word API. (The app runs through a list of medical reports, each a separate Word document, extracts information which it uses to alphabetize the patient on whom the report is made, and pushes the report content into a PDF.) The app appears to run fine when ...

How to set "Run this program as an administrator" programatically.

I'm having a problem with good ol' bdeadmin.exe in Vista. First, let's get the predictable responses out of the way: "You should not require your application to be elevated." This one does. C'est la vie. "You need to embed a manifest file." It is already compiled, it is many years old, the company that created it has no intention of do...

Running Services.msc as a different User C#

Hi, I have a requirement to create a simple windows forms application that allows an admin user to manage the Services on remote servers. We don't want to give the admins the usernames and passwords to the servers so these will be encrypted and stored in a database. My question is whether or not it is possible to spawn a Services.msc wi...

Runas Error: Unable to Acquire Password

I'm trying to start visual studio 2010 from command prompt using 'RUNAS' so that I can run it as a different user. I ran the following command: runas /profile /user:myPCName/SomeUserName "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" My problem is that the commandprompt says "Enter the password for myPCNam...

runas command in windows 7

Hi, I'm trying to run a batch file as admin. I found that I can use runas command which corresponds sudo command in Linux I think. I tried runas /noprofile /user:computername\adminuser "blah.bat start" But it gives an error, saying : Logon failure: user account restriction.. (msdos window doesn't allow me to coppy damn thing I h...

WinAPI C - RunAsUser from REDMON_USER and REDMON_SESSIONID

I installed a PostScript printer driver and have setup REDMON (redmonnt.dll) for redirecting postscript output to my program. In my rather simple c program I capture the data from STDIN and I am able to successfully save it into a .ps file. The file looks OK. However, I want to start gsview.exe for viewing the file. If I call ShellEx...

NAnt: executing NCover as administrator account - runas returns directly without waiting

Hi, My NAnt build runs as a non-admin as part of CruiseControl. But we have an NCover task which needs to run as an Administrator. For this we are thinking about using RunAs with an admin account. The problem is that RunAs returns directly and doesn't wait for the process to exit. Is there a way to block the NAnt build until NCover ha...