Jump to content

RunAs not working with file on a network share


Recommended Posts

Pretty simple issue. v3.3.8.1

I set up a script to run a few of our office programs as an admin. All of the locally installed programs (on the C drive) worked flawlessly, however running the exact script but on a program on our network (S drive) gives me an error. Here is the script:

Local $sUserName = "admin"
Local $sPassword = "***"

RunAs($sUserName, @ComputerName, $sPassword, 1, "S:\test.bat", @SystemDir)

If @error = 1 Then
MsgBox(4096, "Error", "Something went wrong, but I'm not sure why...")
EndIf

I've tried every option for the logon flag and the working directory. Does the RunAs function just not work on network shares?

Link to comment
Share on other sites

  • Developers

Then try using the UNC link to the networkshare because it is unlikely that drive S: is known under the elevated credentials.

Jos :)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

[edit]

Well, I had already tried the unc path to no avail, but I just tried it again and for some reason it's working now. I must have mis-typed the path. I'm still not sure why it wouldn't work using the mapped drive, as I didnt have that problem using autohotkey to do the same task.

Thanks!

Edited by kokomodrums
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...