ericli03 Posted June 17, 2013 Posted June 17, 2013 (edited) How to open a remote computer program through WMI. I use WMI Win32_Process remote computer can successfully open Process,But failed to open a graphical interface that only shows running in the Process. If the remote I run Notepad, how to open it? (Non-Process mode) Like manually open Notepad as open. I am looking for some articles, some say that Windows permissions problem. Code : $Username = "" $Password = "" $Computer = "" Func RemoteExecute($strProgToRun) Local $objWMIService, $objProcess, $objProgram $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") $objWMI = $objSWbemLocator.ConnectServer($Computer, "rootcimv2", $Username, $Password) $objWMI.Security_.ImpersonationLevel = 3 $objProcess = $objWMI.Get("Win32_Process") $objProgram = $objProcess.Methods_("Create").InParameters.SpawnInstance_ $objProgram.CommandLine = $strProgToRun $objWMI.ExecMethod("Win32_Process", "Create", $objProgram) EndFunc Can be performed, but only in Process mode, can not see graphic. Another psexec can start properly, no problem. Edited June 17, 2013 by ericli03
orbs Posted June 17, 2013 Posted June 17, 2013 you can not. this is a security consideration, and a very valid one. remote user - whoever he is, admin or not - should not be allowed to open a process running under the currently logged-on user security context. when you do a remote call, by PsExec or otherwise, it is run under the remote caller context. you are asking for code to run as if the logged-on user called it. there are methods to override this, but the short answer is - you don't. think what you are trying to accomplish, i'm sure you'll find a much more valid and simple way to do it. you can present your goal here, if it is legitimate you will get all the help you can get. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
ericli03 Posted June 17, 2013 Author Posted June 17, 2013 Thank orbs! I wish there could open the remote computer as a way exe file in addition psexec outside .. Tried some methods (WMI, TCP), but it seems there is only Psexec way. There are other ways to remotely turn it?
Moderators JLogan3o13 Posted June 17, 2013 Moderators Posted June 17, 2013 What is the application you're trying to execute remotely, and why would you want to do so in the remote user's context rather than just instructing the user to launch it themselves? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
DW1 Posted June 17, 2013 Posted June 17, 2013 Use task scheduler to run a process interactively on a remote machine. AutoIt3 Online Help
0xdefea7 Posted June 17, 2013 Posted June 17, 2013 If you have the luxury of being able to have your script on the remote PC, you can use TCP to do your work. Check out TCPSend() and TCPRecv() in the helpfile, there are great examples in there of how to use them.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now