Jump to content

RunAsWait not working on Win7


Recommended Posts

Hi Guys,

I have a simple script that calls a batch file to add ports to the local windows firewall. Script was built and tested on Vista, but does not run on Win7 and does not return an error code. Its seems the RunAsWait command is skipped. The compiled exe and batch files are copied to C:\windows\temp. I've tried varies combinations of quotes, double quotes, no path, etc. Its not UAC as it works on Vista. Maybe I'm missing something?

Local $sUserName = "Administrator"
Local $sPassword = "********"

Local $pid = RunAsWait($sUserName, @ComputerName, $sPassword, 0, "C:\Windows\Temp\CiscoPCIP_Firewall.bat", @WorkingDir)
MsgBox(0, "IT Team", " $pid = " & $pid)
MsgBox(0, "IT Team", " @error = " & @error)
Link to comment
Share on other sites

I've just tested this on a different Win7 machine and works perfectly. I think this makes this issue worse or more difficult to troubleshoot. I've seen ppl with issues running AutoIT scripts on Win7, but they are 64bit machines. Event-viewer isn't showing any errors either.

Link to comment
Share on other sites

  • 11 months later...

Hi

I don't have a solution for you, but please note the following.

When using RunAs and RunAsWait you need to make sure, that the secondary logon service is running, and if you run your script from your own computer using e.g. pseexec.exe to get access to a remote computer, both computers must run the secondary logon service. And the secondary logon service needs the workstation service and netlogon service. The netlogon service only runs on domain computers, not on workgroup computers.

You also needs to select a "@workingDir" for the functions, that the end user have write access to.

Sincerely

Jorgen Malmgren

IT-Programmer

Denmark - UTC+1

www.tryware.dk

;o) Your brain is like a parachute. It works best when it's

Sincerely

J. Malmgren

IT-Programmer

http://www.tryware.dk

 

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...