Jump to content
AltF4

Terminal (cmd.exe) launched in context of current user

Recommended Posts

I just thought of another suggestion that would be very helpful.

It would be great to have an option on the terminal window, to have it so that when cmd.exe is launched as a process on the client computer, then it is within the context of the currently logged on user (will probably need to do token impersonation of explorer.exe or some other hack-around).

Another solution would be to have the NT service spawn as interactive (run under the token context of the current user/a specified user)

Because the service is non-interactive, and is running under the NT AUTHORITY\SYSTEM (which can also be see by running 'whoami' in the console - or something like Process Hacker or Process Explorer), then the console does not run in the context of the currently logged on user.

It would be great to have this functionality though, because say for example I want to run a console application that saves the desktop icons of explorer before RDP-ing into the computer (so they dont get foo-bared around). In this case where the terminal (cmd.exe) is running under the context of the user, then the data would be properly saved to the right registry hive (the correct HKCU), for restoration later on.

Some areas to look at:

- Interactive services: http://msdn.microsoft.com/en-us/library/windows/desktop/ms683502(v=vs.85).aspx

- And also here is a large thread that I started back in 2008 on sysinternal's forums about similar things dealing with changing the user context/launching a process within a different context (I provide code at some of the posts at the end), specifically when I talk about ImpersonateLoggedOnUser and CreateProcessAsUser on the 4th page: http://forum.sysinternals.com/tip-run-process-in-system-account-scexe_topic16714.html

- Process launching without UAC notifications: http://www.codeproject.com/KB/vista-security/VistaSessions.aspx

- Discussion of similar topic over at StackOverflow: http://stackoverflow.com/questions/2974425/execute-code-in-another-users-context

Along this line, it may also be useful to investigate connections via telnet too (so if a telnet session is desired, then no port forwarding needs to be setup, and it can simply be proxied through PC Monitor).

Hope this was insightful :)

I really love PC Monitor, and it has great potential!

Share this post


Link to post
Share on other sites

Thank you for your post - we will support this in a future release - it could be useful on several scenarios.

Meanwhile you could define a scheduled task (with no trigger) that runs in a context of a specific user and run the task from your mobile.

Share this post


Link to post
Share on other sites

Thank you very much for adding this to the to-do list :).

That is a good suggestion about running it as a scheduled task.

Would you also make PC monitor capable of running scheduled tasks that are monitored?

You could have it simply run it by name via this native CLI app on windows: schtasks.exe /run /tn "My task name"

That way it is a litter easier than typing that all into/remembering it in the terminal window.

To make it easier now, I simply placed a .bat file that executes that command inside system32, so that i just can type the name of the .bat file in the terminal to run it, but it would be nice to not have to rely on arbitrary proxy batch files laying around.

So maybe that could be another thing to add (could also be useful too, if you are able to remotely create scheduled tasks, but that may take a bit more work and setup screens within PC Monitor, to have all the functionality for it being run correctly)

One other thing.

Maybe you could also have the terminal window be more so like the "Prompt" application in the appstore, where it support various other input keys.

Primarily I would just be happy with having an Up arrow to recall a history of commands (Up = previous, Down = forward).

If you haven't checked out that Prompt app, I suggest doing so just for ideas to improve the terminal window.(as in... the keyboard layout)

2nd-ly I would love to have the terminal window be "Scrolling" as Prompt is - meaning keeping a running list of commands entered, and their responses from the computer - and the user can simply scroll up and down within the window

Some additional actions in the terminal could also include:

- Connecting to telnet (if enabled on the client computer)

- Tapping the screen (off the keyboard), to have the keyboard slide down, so that more of the screen is visible

- Having a favorites window of commands that can be stored (especially for lengthy ones)

- Adding another option to the Arrow (top-right button) that says: Send output to Pastie.org

- Allow setting the font size of the window

- Once vertical scrolling is implemented, it may be useful to provide the user an option to define if word wrap is enabled or disabled (horizontal scrolling would then be enabled)

- And any finishing touches would simply be allowing the user to custom define background and font colors in the terminal.

Sorry for the long list of requests, but these are just suggestions as for what I would do if developing this wonderful application.

The terminal is by far the most useful feature that I find on here (next to the power commands, and WOL LAN-proxy), so I would love to see these improvements of it evolve as development continues forward.

Hope this was helpful :)

Best regards.

Share this post


Link to post
Share on other sites
Would you also make PC monitor capable of running scheduled tasks that are monitored?

This is already supported. You can start / stop existing schedueled tasks that are monitored. This is exactly what Marius suggested in his earlier reply.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...