Guest qpix Posted May 6, 2004 Share Posted May 6, 2004 (edited) i´m trying to execute a patchfile on a net share, that needs domain admin rights. on windows 2000 pcs the code works fine, but on win xp pcs it gives an error: unable to find path. i´ve tried to put the unc path ("\\server\prog\xpenu.exe") but same error. has anyone some idea? thanks here´s the code RunAsSet("Administrator", @LogonDomain, "test") Run(@COMSPEC & ' /C "W:\xpenu.exe" ' , "" , @SW_HIDE) Edited May 6, 2004 by qpix Link to comment Share on other sites More sharing options...
scriptkitty Posted May 6, 2004 Share Posted May 6, 2004 if you log on to that computer with the administrator account can you access that share? try this. RunAsSet("Administrator", @LogonDomain, "test") Runwait(@COMSPEC) RunAsSet() now in that dos window, check what you can see. when you close the commandline window, the script will end. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2004 Developers Share Posted May 6, 2004 i´m trying to execute a patchfile on a net share, that needs domain admin rights. on windows 2000 pcs the code works fine, but on win xp pcs it gives an error: unable to find path. i´ve tried to put the unc path ("\\server\prog\xpenu.exe") but same error.has anyone some idea?thanks here´s the codeRunAsSet("Administrator", @LogonDomain, "test")Run(@COMSPEC & ' /C "W:\xpenu.exe" ' , "" , @SW_HIDE)Don't think it will work when you do a "Net USE w: \\xys\share" and then change credentials and use that mapped drive. Try to make sure no connections are open to the server before the runasset(...) and then run it with UNC.... 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 More sharing options...
Guest qpix Posted May 7, 2004 Share Posted May 7, 2004 (edited) the RunWait(@COMSPEC) genereates an error: Line 0, RunWait(@COMSPEC), unable to execute the external programm, the directory name is invalid.... the strange thing is, that on win2000 everything works fine, also when i execute the file on the local harddisk with only user rights. eg. c:\ on xp. that means that runasset is working. but domain users with xp should be able to execute the file from a net share, like win 2000 users can. there must be some difference in reading directory net share names between win2000 and xp. Edited May 7, 2004 by qpix Link to comment Share on other sites More sharing options...
scriptkitty Posted May 7, 2004 Share Posted May 7, 2004 Wrong Name and or password will give you that error, that is what I was thinking. Test it out until you can get that command window open. Looks like you need to set up an admin acount on that computer. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Guest qpix Posted May 10, 2004 Share Posted May 10, 2004 (edited) I figured out what the problem is: its on the mapped drive credentials under xp. they are different than on w2k. the cmd command is: \\runas /user:domain admin \\server\progs\patch.exe. with that I can execute the file. with a right click + shift on the file it is not working. that brought me to the solution. but how do I insert the password?? or how do I that hole thing with AutoIt, couse the string has to be written exactly like above??? thanks for any help..... Edited May 10, 2004 by qpix Link to comment Share on other sites More sharing options...
emmanuel Posted May 10, 2004 Share Posted May 10, 2004 do what scriptkitty said, use the runasset *points to helpfile* -------------------------------------------------------------------------------- RunAsSet -------------------------------------------------------------------------------- Initialise a set of user credentials to use during Run and RunWait operations. 2000/XP or later ONLY. RunAsSet ( ["user", "domain", "password"]) Parameters username The user name to use. domain The domain name to use. password The password to use. Return Value Returns 0 if the operating system does not support this function. Otherwise returns 1--regardless of success. (If the login information was invalid, subsequent Run/RunWait commands will fail....) Remarks This function allows subsequent Run and RunWait functions to run as a different user (e.g. Administrator). The function only works on the 2000/XP (or later) platforms. NT4 users should install and use the SU command from the NT Resource Kit. The "Secondary Logon service" must not be disabled if you want this function to work. To unset the RunAs details, use the function with no parameters: RunAsSet(). Related RunAsSet, RunErrorsFatal (Option), RunWait Example ; Set the RunAs parameters to use local adminstrator account RunAsSet("Administrator", @Computername, "adminpassword") ; Run registry editor as admin RunWait("regedit.exe") ; Reset user's permissions RunAsSet() "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Developers Jos Posted May 10, 2004 Developers Share Posted May 10, 2004 (edited) I figured out what the problem is: its on the mapped drive credentials under xp. they are different than on w2k.the cmd command is: \\runas /user:domain admin \\server\progs\patch.exe. with that I can execute the file. with a right click + shift on the file it is not working.that brought me to the solution.but how do I insert the password?? or how do I that hole thing with AutoIt, couse the string has to be written exactly like above???thanks for any help.....Is there a difference running the Commandline program RunAs and the Autoit internal command RunAsSet ?In other words :When you have a Mapped drive made with the User credentials and you do a RunAsSet it doesnwork, but when you do a RunAS command it works ??? Edited May 11, 2004 by JdeB 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 More sharing options...
Guest qpix Posted May 11, 2004 Share Posted May 11, 2004 yes. with the cmd command it is working with autoit not. you have to submit the hole string eg. runas /user:domain admin \\server\progs\patch.exe. password when I do it with autoit there is the known error message "cannot find path", cause of the wrong user credentials. of course always under XP, as domain user on a netshare. 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