Jump to content
Sign in to follow this  
kokomodrums

RunAs not working with file on a network share

Recommended Posts

kokomodrums

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?

Share this post


Link to post
Share on other sites
kokomodrums

Yes, full access

I tried looking up a way to get an actual error message, but it was a bit above my head. Is there a simple way to display an actual description of what goes wrong from autoit?

Edited by kokomodrums

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
kokomodrums

[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

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  

×