gulthaw Posted June 6, 2008 Share Posted June 6, 2008 (edited) Hi (yes.. my first post... i'm a lurker ), I've been using autoit since version 2 (awesome job you're doing here though) and I find myself stuck for the very first time. The thing is, i'm trying to create a script to move every user folder but after going through the process of reading LDAP, getting the OU and some other parameters i can't xcopy the folders due to permissions. Since I don't want to reassign permissions we (IT dept.) created a special user who can xcopy those folders but the runas is not working and I don't understand why... Code: RunAs("<user>","<domain>","<pass>",2,@ComSpec ' /c xcopy \\<server1>\users\<user> \\<server2>\users\<OU>\<user> /e/h/o/y',@SystemDir) Error: C:\scripts\testXC.au3(1,142) : ERROR: syntax error RunAs("<user>","<domain>","<pass>",2,@ComSpec ' /c xcopy \\<server1>\users\<user> \\<server2>\users\<OU>\<user> /e/h/o/y' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\scripts\testXC.au3 - 1 error(s), 0 warning(s) Thanks in advance! P.S. Sorry any typo, english is not my main language :S Edited June 6, 2008 by gulthaw Link to comment Share on other sites More sharing options...
Bert Posted June 6, 2008 Share Posted June 6, 2008 try _rundos The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
DaveF Posted June 6, 2008 Share Posted June 6, 2008 The actual depicted error comes from a & missing between @ComSpec and the rest of the command line in the example.Despite that, I think the problem you're describing arises from this: though you've created the child process in a away that declares "use these credentials for any network connections created by the child process", RunAs doesn't establish any network connections itself (that's not its job), and the only process created, XCOPY, doesn't either; it just tries to copy files. DriveMapAdd creates a new network connection (whether or not it actually maps a drive), and you can provide the credentials that it uses for the network connection; you might try that rather than RunAs. In fact, XCOPY will probably be happier if you DriveMapAdd a temporary drive for both target shares... Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
Bert Posted June 6, 2008 Share Posted June 6, 2008 Reading that, I have to agree with Dave. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
gulthaw Posted June 6, 2008 Author Share Posted June 6, 2008 Thanks a lot. Worked like a charm 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