mrmark_f Posted June 14, 2005 Share Posted June 14, 2005 Hello All, Yes I am very new to AutoIt and like the rest I ask that you forgive me for this if it's asked a thousand times. But basically I've tried searching the forums and found what I thought was the answer to my problem. But it still doesn't work. I need to run the simple command "net time /setsntp:<servername>" but it needs to be done as an administrator. So I found in my search the solution (or so I thought) RunAsSet ( "admin", "MyDomain", "Password", 2 ) RunWait("cmd /c net time /setsntp:time.optusnet.com.au") RunAsSet() The script works perfectly ofcourse as an administrator but not otherwise. I even tried just creating a simple batch file with the command in it and running the bat file using RunAsSet but it still didn't work as a normal user. Am I missing something? Link to comment Share on other sites More sharing options...
PerryRaptor Posted June 14, 2005 Share Posted June 14, 2005 Is the RunAs service disabled on the computer or server? Have you tried it without Option 2? Have you doublechecked the local machine Administrator AccountName, password, and the local machine name? Using my Domain Account, in AD, I must list the UserName as "Domain\UserName" to get it work. Some of the 2003 Servers are stubborn... Link to comment Share on other sites More sharing options...
mrmark_f Posted June 14, 2005 Author Share Posted June 14, 2005 Is the RunAs service disabled on the computer or server? Have you tried it without Option 2? Have you doublechecked the local machine Administrator AccountName, password, and the local machine name? Using my Domain Account, in AD, I must list the UserName as "Domain\UserName" to get it work. Some of the 2003 Servers are stubborn...<{POST_SNAPBACK}>Yes! Thankyou, my first successful AutoIt script heheI just removed the option 2 and now it works? go figure? Thanks for the ideas. Link to comment Share on other sites More sharing options...
mrmark_f Posted June 14, 2005 Author Share Posted June 14, 2005 Bah! Now I have another odd but hopefully simple problem. We are using Kix login script and when I add the command in the login script to run the autoit file it doesn't work, it says "unable to execute external program, the directory name is invalid" But if I simply run the script after the user is logged in it runs without a problem. So I don't think there's any problems with the script, but somehow the execution time is an issue? Link to comment Share on other sites More sharing options...
Wus Posted June 15, 2005 Share Posted June 15, 2005 (edited) Ive had this very problem... I think it has to do with sharing/security and permissions on the share... also make sure you use UNC paths not mapped drivesmy ultimate solution was to completely redo my login script in 100% autoIT... works fine now... though in order to access the server i need to do a runnas() admin and restart the scriptrefer to this this linkhttp://www.autoitscript.com/forum/index.ph...807entry83807Just to make sure you understand this,.. unless your not giving a valid UNC path the rpoblem is in your permissions for the user your running the script as... or the sharing on the share... Edited June 15, 2005 by Wus Link to comment Share on other sites More sharing options...
/dev/null Posted June 15, 2005 Share Posted June 15, 2005 try it with a local admin account and specify the computer name when using RunAsSet. RunAsSet("Administrator", @Computername, "adminpassword") Cheers Kurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
mrmark_f Posted June 15, 2005 Author Share Posted June 15, 2005 Thanks for your suggestions guys, I ended up finding the solution myself. This seems to be a very common error but the cause can be any number of things. I guess I got lucky, basically I needed to put an extra item in the RunWait line for a 'working directory'. The script is as simple as below and now it runs fine during login.RunAsSet ( "admin", "MyDomain", "Password" )RunWait("cmd /c net time /setsntp:server1", "\\server2\netlogon")RunAsSet() 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