Jump to content

Runasset With Admin Right On A Netshare


Guest qpix
 Share

Recommended Posts

Guest qpix

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 by qpix
Link to comment
Share on other sites

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

  • Developers

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)

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

Guest qpix

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 by qpix
Link to comment
Share on other sites

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

Guest qpix

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 by qpix
Link to comment
Share on other sites

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

  • Developers

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 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

Guest qpix

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...