runas

Pass Password to runas from Python [duplicate]

只谈情不闲聊 提交于 2020-01-11 11:03:24
问题 This question already has answers here : Using python to open cmd and automatically enter a password (3 answers) Closed 2 years ago . I need to run a file as another user without it prompting for a password, from my script. How is this done? 回答1: There's an executable program called SANUR.EXE that's made for just this kind of situation: you can use it to pipe in the password on the command-line, like this: runas /user:domain\username cmd.exe | sanur mysekritpassword . 回答2: Have the user add

elevated diskpart output

佐手、 提交于 2020-01-05 08:42:23
问题 I need to run diskpart in my python3 script under Windows 7 and capture its output. I run the script in elevated mode; it runs but I can't capture the output and thus can't determine if it was successful. Here's its invocation: win32api.ShellExecute(0, runas, diskpart, /s C:\TEMP\mapRHD.dp > C:\TEMP\diskpart.out, C:\Python3, 1) The C:\TEMP\diskpart.out file doesn't get written. I didn't really think that the redirection "> C:\TEMP\diskpart.out" would work here but I don't know what else to do

Strange file-permissions if apps run as administrator

大兔子大兔子 提交于 2020-01-04 05:17:28
问题 My program must be run as administrator and creates some files. If I run it manually by right-click on the icon and selecting "run as administrator" -- everything okay -- all users have access to created files. But if program launched from the another program by ShellExecuteEx with "runas" verb -- created files have no access entry for BUILTIN\Users group. Only administrator users can read those files. 回答1: Why not setup the linker flag (VC2008 and higher): Linker -> Manifest -> UAC Execution

Strange file-permissions if apps run as administrator

♀尐吖头ヾ 提交于 2020-01-04 05:17:12
问题 My program must be run as administrator and creates some files. If I run it manually by right-click on the icon and selecting "run as administrator" -- everything okay -- all users have access to created files. But if program launched from the another program by ShellExecuteEx with "runas" verb -- created files have no access entry for BUILTIN\Users group. Only administrator users can read those files. 回答1: Why not setup the linker flag (VC2008 and higher): Linker -> Manifest -> UAC Execution

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

三世轮回 提交于 2020-01-02 04:37:56
问题 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 for starting the service: runas /user:myDomain\myUserId "net start serviceName" When I run the above command another command window opens, but flashes away before

How can I run IE with different users and specify a url?

对着背影说爱祢 提交于 2019-12-24 21:30:04
问题 I'm trying to create a console application to replace a batch file. The batch file prompted for a user and ran the following code... RUNAS /user:USA\%usr% "C:\Program Files\Internet Explorer\iexplore.exe %ServerPath%/%AppName%" How can I translate this to C# code? I'm basically using the code below. I declare a User Name and a Path, but it always launches IE with my windows login. Am I using Verb incorrectly? Do I need to include a password, and if so, how? string sPath = ServerPath

Batch file: run command in a cmd.exe launched as a different user using batch file

假如想象 提交于 2019-12-24 04:31:37
问题 Hi Folks I am a newbie to batch files and I am facing a challenge. I have to do following steps using a batch file automatically. Steps 1 and 3 I am able to figure out, however for step 2 i need your help: A. Run command prompt using a user: Comment: This I have figured out, I can do it using: @Echo Off runas /profile /savecred /user:xyzasa\asdasq "cmd" B. Make some registry changes using the command prompt which opened in the previous step Comment: I know this can be done using the reg add

Batch file: run command in a cmd.exe launched as a different user using batch file

北慕城南 提交于 2019-12-24 04:31:05
问题 Hi Folks I am a newbie to batch files and I am facing a challenge. I have to do following steps using a batch file automatically. Steps 1 and 3 I am able to figure out, however for step 2 i need your help: A. Run command prompt using a user: Comment: This I have figured out, I can do it using: @Echo Off runas /profile /savecred /user:xyzasa\asdasq "cmd" B. Make some registry changes using the command prompt which opened in the previous step Comment: I know this can be done using the reg add

runas does not allow complex arguments?

眉间皱痕 提交于 2019-12-23 19:27:38
问题 I have an app that I'm trying to run elevated on windows 7 and windows xp thin clients but I cant seem to get the runas.exe cmd line correct. I know I need the backslash escape character in there so runas interprets the spaces correctly. This works when sending runas a single argument that has been escaped with a backslash. This scenario is all I found as a solution and it works however, I need to send multiple arguments that are all escaped with backslashes because of spaces in the

Start runas as subprocess and write password to stdin?

拜拜、爱过 提交于 2019-12-21 21:32:10
问题 I am trying to write a C# program that is supposed to call the runas tool from windows and input the password automatically. What I tried: Process runas = new Process(); runas.StartInfo.FileName = "runas"; runas.StartInfo.UseShellExecute = false; runas.StartInfo.RedirectStandardInput = true; runas.StartInfo.Arguments = "\"/user:domain\\username\" \"cmd.exe\""; runas.Start(); StreamWriter stream = runas.StandardInput; stream.WriteLine("our super secret password"); stream.Flush(); stream.Close(