runas

Mapping network drive using WNetAddConnection2 from “Run As Administrator” process does not work

自古美人都是妖i 提交于 2019-12-11 07:27:02
问题 I have an application which calls WNetAddConnection2 to map a network drive. This works perfectly unless I run the application as Administrator (right click - Run As Administrator) in which case the function returns 0 (success) but the mapped drive does not appear. What seems to be happening here is that there are two Contexts , the Admin one in which my program is running and the user one in which windows explorer is running and I am looking for the mapped drive. I think the drive mapping is

Using @RunAs in my EJB Schedulers

自作多情 提交于 2019-12-10 19:56:03
问题 I have many EJBs with my business methods. These methods use @RolesAllowed annotation to check if user can execute this method. So I have an EJB Scheduler that calls these EJB methods. EJB schedulers runs with anonymous user, so authorization fails. How I can run my schedulers with other role? For testing proposes, I run with @RunAs("SYSTEM") annotation, but I don't know if this is right. My scheduler class @RunAs("SYSTEM") public class InboxScheduler { protected void inboxFileScan(Timer t) {

Eclipse keep deploying to device in debug mode

你说的曾经没有我的故事 提交于 2019-12-10 17:54:57
问题 After deploying to my device once for debugging, every time I try and "Run As" in regular mode it still attached the debugger. I have deleted the application from the device and it still does this. This causes and issue when I just want to run the app, untethered from my laptop. Has anyone else ran into this issue? If so, how do you fix it. 回答1: Does clicking on the "Disconnect" button do the trick? 回答2: Try restarting Eclipse. I had this issue once and restarting Eclipse worked for me. 回答3:

Batch File… running as administrator [closed]

五迷三道 提交于 2019-12-10 11:55:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I successfully created a batch file to flush my DNS… I have added a pause, I noticed in the title bar of the console window… It's not running as administrator. I've already tried a couple of variations of this… Just a little guidance would be most appreciated. I remember reading a blog somewhere, it said

Can't run batch file from runas command

喜你入骨 提交于 2019-12-10 11:46:27
问题 I'm trying to open a file using runas command from cmd. I succeed when i run it like this: file.bat or like this: start file.bat but when i run: runas /user:username file.bat the file opens but closes immediately (I'm entering the right password). I know that for sure that I'm entering the right password and that the batch file opens and closes without executing its content. Any help please? 回答1: I don't know how to get the runas command to run in the same window. But a trick is to spawn the

How to run executable from PHP website as a specific Windows user?

余生颓废 提交于 2019-12-09 03:41:27
问题 By default PHP runs under IUSR account. When executed directly: $lastline = exec('D:\\MyProgram.exe', $output, $return_var); It runs, but the program is unable to do it's tasks due to insufficient privileges. My question is: How do I run an executable under a specific Windows account from a PHP website? I've tried: When executed through Sysinternals PsExec: $lastline = exec('D:\\PsExec.exe -u UserName -p Password -accepteula "D:\\MyProgram.exe"', $output, $return_var); MyProgram.exe does not

WinAPI C - RunAsUser from REDMON_USER and REDMON_SESSIONID

纵然是瞬间 提交于 2019-12-08 02:04:12
问题 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 ShellExecute it fails in Windows 7 because of permission issues. It seems that my program is called under a different user account (LOCAL SERVICE). So I am looking for a

Can't run batch file from runas command

徘徊边缘 提交于 2019-12-06 16:14:16
I'm trying to open a file using runas command from cmd. I succeed when i run it like this: file.bat or like this: start file.bat but when i run: runas /user:username file.bat the file opens but closes immediately (I'm entering the right password). I know that for sure that I'm entering the right password and that the batch file opens and closes without executing its content. Any help please? I don't know how to get the runas command to run in the same window. But a trick is to spawn the cmd window yourself with the /k switch to prevent it from closing when done: runas /user:username "cmd /k

WinAPI C - RunAsUser from REDMON_USER and REDMON_SESSIONID

六眼飞鱼酱① 提交于 2019-12-06 04:15:47
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 ShellExecute it fails in Windows 7 because of permission issues. It seems that my program is called under a different user account (LOCAL SERVICE). So I am looking for a way to run gsview.exe under a specific username (the user who initiated the print job) which is

Run explorer.exe as Administrator user within Windows 7

[亡魂溺海] 提交于 2019-12-05 18:56:11
I have the Windows 7 operating system, and I have administrator user credentials stored (known in advance). I know we can run a program or .exe using "Runas" verb and launch a process, but my question is specific to explorer.exe. I am trying to run "runas /user: "control.exe printers" it launches successfully after giving a password to the prompt, but when I am checking within TaskManager it is running under my regular user with which I have logged on. I have noticed this is only with explorer.exe. Other programs are working fine as expected with runas. What is the catch here with Windows 7?