Page 1 of 1 1
Topic Options
#43299 - 2003-07-24 03:51 PM Using Sendkeys problem
BMahon Offline
Fresh Scripter

Registered: 2003-07-02
Posts: 7
Loc: Kilkenny, Ireland
Hi. I have this problem when using Sendkeys. I am using the following code to run a program with adminstrative rights. It works on about half of the machines. On the machines where it doesn't work the Runas dialog box becomes stuck on their Windows 2000 screen. It is awaiting a password entry. Would it be possible that the Sendkeys password was implemented to quickly into the Runas dialog box? See below for the code that I am using: (Please not thet this code segment is contained within an IF statement).

SETTITLE ("SENDKEYS")

run 'runas /user:domainname\username

"\\servername\Ant-virusV\AVcheck.bat"'

$SK SetFocus ("SENDKEYS")

$SK= sendkeys("password{enter}")

Top
#43300 - 2003-07-24 04:18 PM Re: Using Sendkeys problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Your line:
$SK SetFocus ("SENDKEYS")

is missing the =
$SK= SetFocus ("SENDKEYS")

but really, that is not good enough anyway. You need to put it into a wait loop.
code:
Break on
Run 'notepad'
while SetFocus('Untitled - Notepad')<>0
"."
sleep 1
$Index = $Index + 1
if $index > 20
$RC = MessageBox("NOTICE!" + Chr(13) + "Notepad did not open within a reasonable time!"
+ Chr(13) + "Please notify the HelpDesk at ext. 1234","Notepad example",48,60)
goto finish
endif
Loop

$RC=Sendkeys('Hey, it worked!')

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43301 - 2003-07-24 05:00 PM Re: Using Sendkeys problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
You might want to read Installing an Application as an Admin as there are more secure ways compared to what you try to do.
_________________________
There are two types of vessels, submarines and targets.

Top
#43302 - 2003-07-24 05:07 PM Re: Using Sendkeys problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OOPS! Forgot to give my Doom and Gloom, and Security Sins, Hellfire and Brimstone speech on using SU and RunAs. [Embarrassed]

What was I thinking... I usually just boycott these topics.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43303 - 2003-07-24 05:10 PM Re: Using Sendkeys problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Can we have that as a FAQ and then just point people to it as soon as a post contains the word RUNAS ? [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#43304 - 2003-07-24 05:50 PM Re: Using Sendkeys problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Like I said, I usually just sit on my hands. Was focused more on just the SendKeys() part.

If I were Chief Information Security Officer, I would fire anyone that passed passwords through a logon script!

[ 24. July 2003, 17:51: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43305 - 2003-07-25 11:29 AM Re: Using Sendkeys problem
BMahon Offline
Fresh Scripter

Registered: 2003-07-02
Posts: 7
Loc: Kilkenny, Ireland
The account does not use a Domain Adminsitrator account...just an account that is added to the local adminstrators group using Windows Group Policy...Also on completion, the script will be encrypted. Still having trouble tring to implement the while using my code example. Thanks
Top
#43306 - 2003-07-25 02:36 PM Re: Using Sendkeys problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
A domain account that gets me local admin access to every machine is still dangerous. With it, I could hack to every computer in the org over the network, install keyloggers and start collecting passwords!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 515 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.044 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org