Jump to content

VBscript using RunAsSet fails to finish


Recommended Posts

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

Link to comment
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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...