Azrael Posted September 16, 2009 Posted September 16, 2009 Hey all, Hope you are all doing well I'm having trouble understanding or making something work the way I'd like. In short - if I use ShellExecute() to spawn a command prompt window on a remote PC via TCP - it works, the window appears, I can type in it - run commands in it etc. If I use RunAs() to spawn the same command prompt window using alternative credentials - the window appears as part of the TCP server (as in, it doesn't spawn a seperate window) and also, I cannot type in this window at all. The RunAs part works (or seems to work) okay, it's just the fact I can't input anything into the window and that it doesn't spawn it's own window. Why do I want to do this? Testing and debugging mainly - lets me remotely test and debug via standard (user) credentials and admin credentials as the TCP Server is running, so I can assess when I need to use RunAs or not. Is there a version of ShellExecute() where I can specify alt credentials? I know about the 'runas' verb, but that brings up a window ASKING for the credentials. Somewhat seperately - is it possible to fire up a REMOTE command prompt on a PC - like you can with Windows 2000/XP telnet server? (Obviously I could use that - but AFAIK it doesn't exist on Vista or Windows 7) Thanks Az
jvanegmond Posted September 16, 2009 Posted September 16, 2009 I'm not sure how to deal with your problem(s). You seem to have a lot of problems and solutions for them at once. Without answering your question (Sorry), is this something like what you want to do? http://www.autoitscript.com/forum/index.php?showtopic=101602 github.com/jvanegmond
Azrael Posted September 16, 2009 Author Posted September 16, 2009 I'm not sure how to deal with your problem(s). You seem to have a lot of problems and solutions for them at once.Without answering your question (Sorry), is this something like what you want to do?http://www.autoitscript.com/forum/index.php?showtopic=101602Manadar,Thanks for your reply - yeah I have alot of problems, just ask my shrink Okay, I downloaded the files from the link you sent and it looks like what I'm looking for (at least on the second part of my question).The real issue I'm having is with ShellExecute() and Runas.If I use the 'runas' verb with ShellExecute() it asks for credentials, is there a way to bypass that box and supply the credentials myself?Az
jvanegmond Posted September 16, 2009 Posted September 16, 2009 Is there a version of ShellExecute() where I can specify alt credentials?There is no such version. You will need to stick to using the RunAs command. But I don't understand at all why you're not able to type into the cmd box.I also rang up your shrink, he told me the information about your mental health was confidential. github.com/jvanegmond
Mecrazycoder Posted September 16, 2009 Posted September 16, 2009 Manadar,Thanks for your reply - yeah I have alot of problems, just ask my shrink Okay, I downloaded the files from the link you sent and it looks like what I'm looking for (at least on the second part of my question).The real issue I'm having is with ShellExecute() and Runas.If I use the 'runas' verb with ShellExecute() it asks for credentials, is there a way to bypass that box and supply the credentials myself?AzDude how did you access remote system? Can you please let me know? [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]
Azrael Posted September 16, 2009 Author Posted September 16, 2009 There is no such version. You will need to stick to using the RunAs command. But I don't understand at all why you're not able to type into the cmd box. I also rang up your shrink, he told me the information about your mental health was confidential. Haha Okay I will have to stick to RunAs then - kind of a shame but there we go. I've compiled the telnet version of the script - it has an error on Line 117. I compile it, run it, it gives the following error when I try to login: H:\Kixtart\AutoIT\UDFs\TelnetBased\RemoteCmdControl.au3 (117) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $UserPass[1] = $User And $UserPass[2] = $Pass Then If $UserPass[1] = $User And ^ ERROR As it's not my script, I'm a little unsure as to how to fix this as I don't want to break it. Az
Cheez Posted September 16, 2009 Posted September 16, 2009 (edited) Credentials have to be passed to it in the format "User Pass" (space delimited) If you want to stop the crash (other than by using correct format): 113: $UserPass = StringSplit($Clients[$hSocket][2], " ") 114 If UBound($UserPass) < 2 Then 115: _TCP_Send($hSocket, "- Bad username + pass format" & @CRLF) 116: ExitLoop(2) ;Jumps out of the ifs. 117:EndIf Edited September 16, 2009 by Cheez
jvanegmond Posted September 16, 2009 Posted September 16, 2009 (edited) Haha Okay I will have to stick to RunAs then - kind of a shame but there we go. I've compiled the telnet version of the script - it has an error on Line 117. I compile it, run it, it gives the following error when I try to login: H:\Kixtart\AutoIT\UDFs\TelnetBased\RemoteCmdControl.au3 (117) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $UserPass[1] = $User And $UserPass[2] = $Pass Then If $UserPass[1] = $User And ^ ERROR As it's not my script, I'm a little unsure as to how to fix this as I don't want to break it. Az I've only tried the regular remote command control, not the telnet based version. I'm not sure how to fix this either, and don't have time to go into detail here at the moment. Try if the regular version works for you (RemoteCmdControl.zip (7.87K)). Edit: Never mind, Cheez wins. Edited September 16, 2009 by Manadar github.com/jvanegmond
Azrael Posted September 16, 2009 Author Posted September 16, 2009 Dude how did you access remote system? Can you please let me know?Dude...It's quite simple once you get to grips with AutoIT and TCP.How familiar are you with AutoIT?Have you done any TCP programming before?If you aren't that familiar, I'd suggest looking at existing scripts and making small changes to them yourself to quickly (and safely) learn AutoIT.If you are familiar with it, then look in the AutoIT help file at TCP* functions.Look around the forum at other posts and such on smaller TCP projects, like an echo server or something basic so you can learn it as you go - then slowly build up to bigger and bigger projects or goals Az
Azrael Posted September 16, 2009 Author Posted September 16, 2009 Credentials have to be passed to it in the format "User Pass" (space delimited) If you want to stop the crash (other than by using correct format): 113: $UserPass = StringSplit($Clients[$hSocket][2], " ") 114 If UBound($UserPass) < 2 Then 115: _TCP_Send($hSocket, "- Bad username + pass format" & @CRLF) 116: ExitLoop(2) ;Jumps out of the ifs. 117:EndIf That's great - thanks Cheez. Az
Mecrazycoder Posted September 16, 2009 Posted September 16, 2009 (edited) Dude...It's quite simple once you get to grips with AutoIT and TCP.How familiar are you with AutoIT?Have you done any TCP programming before?If you aren't that familiar, I'd suggest looking at existing scripts and making small changes to them yourself to quickly (and safely) learn AutoIT.If you are familiar with it, then look in the AutoIT help file at TCP* functions.Look around the forum at other posts and such on smaller TCP projects, like an echo server or something basic so you can learn it as you go - then slowly build up to bigger and bigger projects or goals AzTanx man...I am quite familiar with AutoIT and TCP. I also did some tcp chat using AutoIT. Tanx for the clue. Edited September 16, 2009 by Mecrazycoder [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]
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