RDoes Posted February 2, 2005 Share Posted February 2, 2005 Hi There, I have a problem with the RunAsSet() function. When I make a script like the one below it runs fine as long I run it directly from a local drive. As soon I place this script on a network share it fails. I can not logon any more the @Error is always set to 1 I run this script on a Windows 2003 domain Any Idea ? Thanks. expandcollapse popupOpt("ExpandEnvStrings", 0) ;0=don't expand , 1=do expand Opt("MustDeclareVars", 0) ;0=no , 1=require pre-declare Opt("RunErrorsFatal", 0) ;1=fatal , 0=silent set @error Opt("TrayIconDebug", 0) ;0=no info , 1=debug line info Opt("TrayIconHide", 0) ;0=show , 1=hide tray icon ;**************************************************************************** ; Enter Credentials. ; Exit when cancel is pressed. ;**************************************************************************** $User = Inputbox("Enter account value's 1/3", "User Name.", "") If $User = "" then Exit EndIf $Password = Inputbox("Enter account value's 2/3", "Password.", "") If $Password = "" then Exit EndIf $Domain = Inputbox("Enter account value's 3/3", "Domain.", "") ;**************************************************************************** ; Set RunAs credentials. ;**************************************************************************** RunAsSet($User, $Domain, $Password) ;**************************************************************************** ; Test the credentials. ; If the credentials are not OK then the runwait failed to execute properly. ;**************************************************************************** RunWait(@ComSpec & " /k exit","",@SW_HIDE) $LoginOk = @Error ;**************************************************************************** ;Finally display the result to me. ;**************************************************************************** If $LoginOk <> 0 then MsgBox(16, "Error Logon", "Unable to logon. " & $LoginOk) Else MsgBox(64, "Logon...", "Succesfully loged on " & $LoginOk) EndIf Link to comment Share on other sites More sharing options...
Andre Posted February 2, 2005 Share Posted February 2, 2005 Hi, Indeed it fails because when using the credentials from another user the shares are not there......... In othere words running from a mapped drive does not work. Running it from an UNC path works fine. Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now