Jump to content

Looking for a little help


Recommended Posts

Hi All,

Here si the issue im having. I have an exe file i need users to install. Problem is these users are remote and dont have admin rights. I need something that these people can click on that will run this exe as an admin account we have for our domain. They cant know the password. So they should just be able to double click this file and it will install this exe with admin right with no login data entered by the user.

Ive done some searches and couldnt find anything. Any help is much appreciated.

Link to comment
Share on other sites

Hi ScriptGuy,

1st Welcome to the AutoIt Forums! :idiot:

Some of the following tips may not apply to you, but it may make your life a bit easier here on the forum in the future.

CODE
  • Did you know that we have an awesome search feature?

    You can find many answers to your current questions, just by typing in the right search patterns.

  • A suggestion is to use the Advanced Search mode:

  • Type your specific search term in quotes.
  • Click the forum you want to search in (the one most likely to have your information would generally be the Example Script forum and or the General Help and Support Forum).
  • Click on "Search titles only" radio button.
  • Click perform search.
The above will help you narrow down your searches and prevent you from unneccesarily posting a new thread.

[*]Also, you should try to read the Sticky posts that are at the top of each of the AutoIt Forums you enter such as:

[*]Keep in mind, the help file will be your best friend, however you may find some of the tutorials written by some of our elite forum members helpful.

[*]Forum Etiquette:

  • Making a new thread:

    • Use the Search feature first to see if your question has already been answered.
    • Look in the help file as well before even thinking of posting (When what you want could be obtained by simply reading the help file, you don't generally get a good response from your AutoIt community).
    • Titles are very important here. 1 word titles or titles like "help me", "write something for me", "I'm a noob" etc... aren't tolerated.
    • Make sure you are posting in the correct forum:

      • General Help and Support:

        • This forum is for AutoIt related support questions only. If you have a question related to another language, or nothing at all to do with AutoIt then you need to post in the chat forum, or in that languages perspective forum.
      • Example Script:

        • This forum is for AutoIt scripts/executables only.
        • Source code is preferred but not necessary, you do have the right to just post the binary of your project if you wish.
        • Please don't post questions in this forum unless it's directly related to a thread already existing.
    • Use common sense when creating a new thread.

      Ask yourself if the title is descriptive enough to even interest someone (preferably those that know what they are talking about) to even look at your thread, let alone reply in it.

    • Think about how it would show in the search feature if someone were to look for something just like you are looking for (think of the keywords you used yourself and obviously didn't find anything (because we know you used the search feature :) ) and use those types of keywords in your title as well).
  • Thread content:

    • Be descriptive with your query. (Make sure we actually know what you want to do).
    • Show you've made an effort in coding what you want (provide the reproducer code (generally no more than 50 lines as people lose interest in debugging someones script for free)).
    • Don't talk in ebonics. A lot of the forum members are adults, and a lot of them know how to help you, but talk like a child, you'll be treated as such.
    • Don't ask for help making keyloggers, spam (even if it's to do as a prank), or anything that can be thought of as malicious. You'll more than likely have the thread locked by a moderator, and take a bashing from your fellow AutoIt community.
    • When posting code, use code boxes. This can be accomplished by using [code ]<content here>[/code ] (No spaces between the brackets []).

      Using code boxes will keep the indentation and make it easier to read for others to help you.

  • Bumping your threads:

    • Use common courtesy here.

      Keep in mind every time you bump your thread to the top of the forum, you knock the other threads down a notch.

      Everyone posting for help has just as much right for their threads to get read as you do.

      Because of that, do not bump your post more than once in a 24 hour period.

      A Bump is simply posting in your thread with nothing that pertains to your query with the sole purpose of moving it up.

      Deleting previous bumps, and posting new ones is not tolerated, and the moderators can find those deletions, so do yourself a favor and don't cross that line >_< .

  • Rude or obnoxious content:

    This falls pretty much under the common sense thing. If you use it (common sense) before posting, you won't have issues.

    • Don't use foul language, remember, a lot of the community is at work when they read these threads.
    • Don't provoke or instigate an argument with someone.
  • Double Posting:

    • It's understood that sometimes there's a lag in the system, and sometimes people don't see their post go up right aways so they post again.

      If this happens to you, simply notify a moderator with the report feature in the post, and politely ask them to delete it.

    • If you're just creating another topic because your original topic is not being answered the way you want or at all, this is not tolerated. You could lose your posting privileges all together over it.
  • Non-English languages

    • If English is not your primary language, please make an attempt to interpret (yourself or online) and post that interpretation.

      We have wonderful users from around the world, so after you've done your post in English, back it up with your question also in your native tongue (You may find your answer much quicker using both).

That's it for now, I hope you have a wonderful learning experience, and hope to see you contribute to the community as your knowledge grows.
Link to comment
Share on other sites

Runas() in the help file should work.

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

This is the holy grail for all virus authors, so I am not surprised you have not found it.

Hi All,

Here si the issue im having. I have an exe file i need users to install. Problem is these users are remote and dont have admin rights. I need something that these people can click on that will run this exe as an admin account we have for our domain. They cant know the password. So they should just be able to double click this file and it will install this exe with admin right with no login data entered by the user.

Ive done some searches and couldnt find anything. Any help is much appreciated.

Link to comment
Share on other sites

This is unfortunate, as I'm having a similar problem; I need to retreive the user's password to silently set up network shares.

the working .bat file commands are as follows:

REM V: Drive
 
 Net Use V: /Delete
 IF ERRORLEVEL 1 @ECHO No V: Drive to reset, continuing...
 Net Use V: \\10.1.0.45\Home %PASSWORD% /user:%USERNAME%
 IF ERRORLEVEL 1 pause

Here's what I have so far in AutoIT, which fails:

#NoTrayIcon
 #include "Misc.au3"
 
;` Run only one instance
 if _Singleton("Remap",1) = 0 Then
     Exit
 EndIf
 
;~ Update environment variables
 EnvUpdate()
 
;~; Example
;~ $status = RemapShare("S:","\\server\netshare",EnvGet("USERNAME"),EnvGet("PASSWORD"))
;~ If @error then MsgBox(0x41010,"COMPANY network share - Error!","Drive S: " & $status & " -  Error code " & @error & ".  ",5)
 
; Access PC
 $Status = RemapShare("T:","\\10.1.1.9\Home",EnvGet("USERNAME"),EnvGet("PASSWORD"))
 If @error then MsgBox(0x41010,"COMPANY network share - Error!","Drive T: " & $Status & " -  Error code " & @error & ".  ",5)
 
; Crystal server
 $Status = RemapShare("V:","\\10.1.0.45\Home",EnvGet("USERNAME"),EnvGet("PASSWORD"))
 If @error then MsgBox(0x41010,"COMPANY network share - Error!","Drive V: " & $Status & " -  Error code " & @error & ".  ",5)
 
;~ End
 exit
 
;~ Remap persistent net shares
 Func RemapShare($sDriveLetter, $sNetPath, $sUsername = "username", $sPassword = "password")
     $RetVal = DriveMapGet($sDriveLetter)
     If @error > 0 Then
         $RetVal = DriveMapAdd($sDriveLetter, $sNetPath, 0, $sUsername, $sPassword)
         If @error > 0 Then
             Seterror(1)
             return "FAILED"
         EndIf
         seterror(0)
         Return "MAPPED"
     Else
         If $RetVal <> $sNetPath Then
             SetError(2)
             Return "CONFLICT"
         EndIf
         $RetVal = DriveMapDel ($sDriveLetter)
         If @error > 0 Then
             Seterror(3)
             return "FAILED"
         EndIf
         $RetVal = DriveMapAdd($sDriveLetter, $sNetPath, 0, $sUsername, $sPassword)
         If @error > 0 Then
             Seterror(4)
             return "FAILED"
         EndIf
         seterror(0)
         Return "REMAPPED"
     Endif  
 Endfunc

Is this incorrect? Is there another way to do what I want?

Don't hijack threads.

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

The example in the helpfile should be sufficient. @ComSpec will kick off cmd.exe.

; Fill in the username and password appropriate for your system.
Local $sUserName = "bob"
Local $sPassword = "bob"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec, @SystemDir)

You do need to realize that this would require you to put the password in plain text into a compiled AutoIt exe. This is NOT secure.

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

The example in the helpfile should be sufficient. @ComSpec will kick off cmd.exe.

; Fill in the username and password appropriate for your system.
Local $sUserName = "bob"
Local $sPassword = "bob"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec, @SystemDir)

You do need to realize that this would require you to put the password in plain text into a compiled AutoIt exe. This is NOT secure.

Yes i understand that the pw will be visable if they un compile the exe. However, we are currently handing out the admin pw sp they can install it. So this should be much more secure than the current practice.

Is it possible to run MSI's from this script? What would the second line look like running a file name test.msi located on the root of C:

Link to comment
Share on other sites

Yes i understand that the pw will be visable if they un compile the exe. However, we are currently handing out the admin pw sp they can install it. So this should be much more secure than the current practice.

Is it possible to run MSI's from this script? What would the second line look like running a file name test.msi located on the root of C:

; Fill in the username and password appropriate for your system.
Local $sUserName = "bob"
Local $sPassword = "bob"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec & "/c msiexec /i C:\test.msi", @SystemDir)

I believe that's right.

"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

Link to comment
Share on other sites

; Fill in the username and password appropriate for your system.
Local $sUserName = "bob"
Local $sPassword = "bob"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec & "/c msiexec /i C:\test.msi", @SystemDir)

I believe that's right.

Hmm that didnt seem to work.

What if i wanted to do this.

I got it to open the cmd prompt as an admin. Now i want it to run this in the cmd prompt.

c:\

msiexec /i test.msi ADDLOCAL=ALL CLASSIC_MODE=yes

This is basicaly the contents of the batch file we were using to run the msi with the switches. Id like to incorporate this ito the autoit script.

So it would run cmd as admin, then have these commands run in the cmd prompt.

Edited by ScriptGuy
Link to comment
Share on other sites

Hmm that didnt seem to work.

What if i wanted to do this.

I got it to open the cmd prompt as an admin. Now i want it to run this in the cmd prompt.

c:\

msiexec /i test.msi ADDLOCAL=ALL CLASSIC_MODE=yes

This is basicaly the contents of the batch file we were using to run the msi with the switches. Id like to incorporate this ito the autoit script.

So it would run cmd as admin, then have these commands run in the cmd prompt.

I always seem to have a hard time with the @ComSpec, so I use what is probably a horrible method.

Here is an example of what I have done here to install the Outlook Junk Mail Reporting Tool:

$command = 'msiexec.exe /i C:\temp\reportjunk\JunkEmailReportingTool.MSI /quiet /le C:\temp\reportjunk\log.txt'

DirCreate("C:\temp\reportjunk")

FileInstall("PathToSourceFile\JunkEmailReportingTool.MSI","C:\temp\reportjunk\JunkEmailReportingTool.MSI", 1)

RunAsWait("username", "domain", "password", 0, $command, "C:\temp\reportjunk", @SW_HIDE)

If @error = 0 Then
    DirRemove("C:\temp\reportjunk", 1)
EndIf

Of course I removed the actual source location, username, password, and domain. This was successful in rolling it out to thousands of machines, though I know it is probably not the best.

"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

Link to comment
Share on other sites

So what would what im trying to do look like?

; Fill in the username and password appropriate for your system.
Local $sUserName = "bob"
Local $sPassword = "bob"
Local $command = 'msiexec /i c:\test.msi ADDLOCAL=ALL CLASSIC_MODE=yes'

; Run a command prompt as the other user.
RunAsWait($sUserName, "domain", $sPassword, 0, $command)

Just a helpful note, at least try writing back with an example of what YOU think the code should be, that way we can explain the logic of it being right or wrong rather then doing it for you. :)

"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

Link to comment
Share on other sites

; Fill in the username and password appropriate for your system.
Local $sUserName = "bob"
Local $sPassword = "bob"
Local $command = 'msiexec /i c:\test.msi ADDLOCAL=ALL CLASSIC_MODE=yes'

; Run a command prompt as the other user.
RunAsWait($sUserName, "domain", $sPassword, 0, $command)

Just a helpful note, at least try writing back with an example of what YOU think the code should be, that way we can explain the logic of it being right or wrong rather then doing it for you. :)

Thank you for your help, I really appreciate it. This code doesnt seem to do what i need it to, but ill try to get it to work.

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