Sign in to follow this  
Followers 0
dcjohnston

VBscript using RunAsSet fails to finish

5 posts in this topic

The script starts and takes input from the user, but instead of installing the printer, the script ends. If I run the script seperatly it runs fine. Is there any reason for the script ending before completion?

Thanks

Dim $Myname

Dim $Domain

Dim $myPassword

$Myname="a9dj5"

$Domain="Corp"

$myPassword="mypass"

If FileInstall("c:\Ipprint.vbs", @ScriptDir & '\', 1) Then

RunAsSet($Myname, $Domain, $myPassword)

Run(@ComSpec & ' /c cscript "' & @ScriptDir & '\ipprint.vbs"')

Else

MsgBox(16, "Error", "Failed to extract required VBScript file.")

EndIf

Share this post


Link to post
Share on other sites



The script starts and takes input from the user, but instead of installing the printer, the script ends. If I run the script seperatly it runs fine. Is there any reason for the script ending before completion?

That code looks familiar! :rolleyes:

Use RunWait() instead of Run(), if you want the script to wait for the command to complete.

:rambo:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yup, its yours my friend, however the code executes and the vbscript input boxes come up to accept information. When the part of the vbscript starts that installs the printer and iP port, the cscript window dissappears and no printer gets installed. The script runs fine outside the Autoit code.

Could this be an issue with rights? I am using the correct credentials. It seems when the part of the vbscript that requires admin rights starts, the process ends.

That code looks familiar! :rolleyes:

Use RunWait() instead of Run(), if you want the script to wait for the command to complete.

:rambo:

Edited by dcjohnston

Share this post


Link to post
Share on other sites

Solved.. I think...

Here is the code. I had to use the 2

RunAsSet($Myname, $Domain, $myPassword,2)

Stay tuned.... Yup that did it... Its all in the options...

Thanks again...

Yup, its yours my friend, however the code executes and the vbscript input boxes come up to accept information. When the part of the vbscript starts that installs the printer and iP port, the cscript window dissappears and no printer gets installed. The script runs fine outside the Autoit code.

Could this be an issue with rights? I am using the correct credentials. It seems when the part of the vbscript that requires admin rights starts, the process ends.

Share this post


Link to post
Share on other sites

Here is the code. I had to use the 2

RunAsSet($Myname, $Domain, $myPassword,2)

Stay tuned.... Yup that did it... Its all in the options...

Thanks for posting your results. I hadn't thought of that option, so I learned something from it too.

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  
Followers 0