Jump to content
jschafer65

Autoit Runas executing a VB

Recommended Posts

jschafer65

hello all,

I'm stumped.   I'm trying to launch a VB script from scriptdir using runas autoit command.

If anyone has some suggestion I would appreciate it.

$UserName =
$password =
$domain =

;Determine Architecture
$WScript = "C:\Windows\System32\WScript.exe "
If FileExists("C:\Windows\SysWOW64\WScript.exe") Then
   $WScript = "C:\Windows\SysWOW64\WScript.exe "
EndIf

RunAs($UserName, $domain, $Password, 1, $WScript & @ScriptDir & "\AddFieldServices.vbs", @ScriptDir)

Share this post


Link to post
Share on other sites
Subz

Not sure what you mean by ;Determine Architecture, since both Windows x64 and x86 will both be C:\Windows\System32\WScript.exe it's only if the script is running as 32bit you may want to change to SysWOW64.  Hope that makes sense.  Can you try the following and see if this works:

$UserName =
$password =
$domain =

;Determine Architecture
$WScript = "C:\Windows\System32\WScript.exe"
RunAs($UserName, $domain, $Password, 1, @ComSpec & ' /c "' & $WScript & '" "' & @ScriptDir & '\AddFieldServices.vbs"')

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×