 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
jpkishere Guest
|
Posted: Wed Apr 20, 2005 2:33 pm Post subject: runas not working??? |
|
|
Trying to get the runas command to work, but can't seem to figure it out..
Here is the code:
RunAs,Administrator,mypassword
FileInstall, Bat.dll, C:\Program Files\MPTS\Bat.dll, 1
RunWait, C:\winnt\system32\regsvr32.exe /s C:\Program Files\MPTS\Bat.dl
runas
If I run this, I get an error of:
Login Error: Unknown username or password.
If I use the built-in runas (on win2k) it works fine and the password is accepted..
Thanks |
|
| Back to top |
|
 |
jpkishere Guest
|
Posted: Wed Apr 20, 2005 2:36 pm Post subject: runas.. |
|
|
FYI - I have also tried this runas command line:
RunAs,Administrator,mypassword, myhomepc
myhomepc being my local PC name.. Please note that this PC is in a domain.. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 4:09 pm Post subject: |
|
|
have you also tried | Code: | | RunAs,Administrator,mypassword, @myhomepc |
i know you said that this pc is in a domain-- but i assume that your trying to use its local admin credentials (since your 1st attempt didn't include domain info..) |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 4:11 pm Post subject: |
|
|
| another question: is your computer using a roaming profile-- or local? |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 5:06 pm Post subject: |
|
|
| Anonymous wrote: | have you also tried | Code: | | RunAs,Administrator,mypassword, @myhomepc |
i know you said that this pc is in a domain-- but i assume that your trying to use its local admin credentials (since your 1st attempt didn't include domain info..) |
Yes I am trying to do local credentials.. The first time I tried, I tried with:
RunAs, Administrator, mypassword, %A_COMPUTERNAME%
I didn't use the @ sign.. I will try that now.. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 5:06 pm Post subject: |
|
|
| Anonymous wrote: | | another question: is your computer using a roaming profile-- or local? |
it is the local admin account (so not a roaming profile) |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 5:08 pm Post subject: |
|
|
| If I add the @ sign, it doesn't work at all.. I must note; that this only seems to happen when I actually compile the code.. If I run it stand-alone it seems to work????? |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 5:15 pm Post subject: |
|
|
Alright, I think I figured this out...
Here is my whole script:
FileAppend, MPTS Upgrade\n\n, C:\\source\\MPTS.log
FileInstall, BatchManagement.dll, C:\Program Files\MPTS\BatchManagement.dll, 1
RunAs,administrator,mypassword,%A_COMPUTERNAME%
Run, cmd.exe
RunWait, C:\winnt\system32\regsvr32.exe /s /u C:\Program Files\MPTS\Database.dll
FileAppend, DATABASE.DLL UNregister: %errorlevel% \n, C:\\source\\MPTS.log
RunWait, regsvr32 /s C:\Program Files\MPTS\BatchManagement.dll
RunAs
The above works...
If I put the fileinstall command inside of the "RUNAS" section it does not work.. But since not all users have rights to the program files section, how do I ensure that the files get copied.. (that is the reason why I wanted to do the runas and the fileinstalls together..) |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 5:54 pm Post subject: |
|
|
| Quote: | | But since not all users have rights to the program files section |
users usally have read/write access to the program files folder (other-wise they wouldn't be able to run programs!)-- evan if they are unable to browse through it w/ explorer. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 6:01 pm Post subject: |
|
|
| Anonymous wrote: | | Quote: | | But since not all users have rights to the program files section |
users usally have read/write access to the program files folder (other-wise they wouldn't be able to run programs!)-- evan if they are unable to browse through it w/ explorer. |
That is wrong. Users never need write access to program files folder to execute a program. This is only required for programs which store settings into the program folder, which is a bad behavior. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 20, 2005 6:22 pm Post subject: |
|
|
| Quote: | FileInstall, BatchManagement.dll, C:\Program Files\MPTS\BatchManagement.dll, 1
|
Could it be that you don't have the full path of the batchmanagement.dll..?
whenever uncompiled-- command just performs filecopy-- so thats why it works then. once you compile it-- it isn't including it in exe
per help file: | Quote: | | The full path and name of the file to add to the compiled EXE. It must not contain double quotes, variable references (e.g. %ProgramFiles%), or wildcards |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Wed Apr 20, 2005 7:08 pm Post subject: |
|
|
| Quote: | | If I put the fileinstall command inside of the "RUNAS" section it does not work.. But since not all users have rights to the program files section, how do I ensure that the files get copied.. (that is the reason why I wanted to do the runas and the fileinstalls together..) | RunAs applies only to the Run and RunWait commands. It doesn't change the permissions of a command such as FileInstall. To work around this, you could FileInstall the file in a temporary folder then use RunAs+RunWait to run a hidden cmd window that uses the "move" command to move the file. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|