Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Please Help!!

28 views
Skip to first unread message

juan.laza...@gmail.com

unread,
Oct 4, 2012, 6:29:27 PM10/4/12
to
Can a VBexpert please help? My script won't run.

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")

cmdpath = "\System32\cmd.exe /c"
adminuser = "blahdomain\blahuser"
windir = WshSysEnv("WINDIR")
cmdpath = windir & cmdpath
CRLF = chr(10) & chr(13)

strAccountPassword = "blah"

WshShell.Run cmdpath
WScript.Sleep 150
WshShell.AppActivate cmdpath
WScript.Sleep 150
WshShell.SendKeys runas /user:adminuser "cscript.exe C:\scripts\script.vbs" & CRLF
WScript.Sleep 150
WshShell.SendKeys strAccountPassword & CRLF
WScript.Sleep 150
WshShell.SendKeys "pause" & CRLF

Bob Barrows

unread,
Oct 8, 2012, 4:05:23 PM10/8/12
to
juan.laza...@gmail.com wrote:
> Can a VBexpert please help? My script won't run.
>
No, we can't help. Not without knowing what symptoms you are experiencing.
You've told us your problem without describing the symptoms. Would you
expect a car mechanic to be able to fix your car if all you told him was
that it's got a problem?

Tell us the error message, if any, you are getting. Give us an idea of what
line of code is raising the error. (hint - comment out all the lines except
the first. Run the code. If no error, uncomment the next line and run it.
Repeat until the error occurs)


Dave "Crash" Dummy

unread,
Oct 8, 2012, 9:48:23 PM10/8/12
to
I'm with Bob, but there is an obvious syntax error in the "runas" line.
It should be

WshShell.SendKeys "runas /user:adminuser cscript.exe
C:\scripts\script.vbs" & CRLF

--
Crash

"The fewer the facts, the stronger the opinion."
~ Arnold H. Glasow ~
0 new messages