Jump to content

Run an installer as Admin from network drive


Recommended Posts

Hi

I am new to autoIT script and just wondering if anyone could help me with a simple installation script

I want to allow user to run an installer, which stored on our network drive

However, most users dont have admin rights

In the old days, i have to walk up to the user's computer then issue commands

runas /user:administrator myadminpassword cmd.exe

*Admin command prompt comes out then type

net use Z: \\fs01\Software /user:mydomain\MysharedAccount MySharedPassword

Z:\myprogram\install.exe

I am trying to get it done via AutoIT script which could hide my admin password within the .exe

I have several attempt but all failed

I already tried to search thru the forum but nothing quite work as i expected

http://www.neowin.net/forum/topic/922704-secure-use-of-passwords-in-batch-files/page__st__30

Can anyone please guide me thru?

Thanks

Here is my code

$MapDriveMachineName = "fs01"

$NetworkDomain = "mydomain"

;My shared account user account for accessing the network drive

$NetworkUsername = "mysharedaccount"

;NetworkPassword - your network password

$NetworkPassword = "mypassword"

$RUN_CREATE_NEW_CONSOLE = 0x10000

$STDOUT_CHILD=0x2

$AdminAccount = "Administrator"

$AdminPassword ="Admin1234567"

$ComputerName= @ComputerName

RunAsWait($AdminAccount, @ComputerName, $AdminPassword, 0, @ComSpec & " /c" , @SystemDir, @SW_MAXIMIZE,$RUN_CREATE_NEW_CONSOLE)

RunAsWait($AdminAccount, @ComputerName, $AdminPassword, 0, @ComSpec & " /c net use Z: \\fs01\Software /user:mydomain\mySharedAccount mypassword" , @SystemDir, @SW_MAXIMIZE,$RUN_CREATE_NEW_CONSOLE)

RunAsWait($AdminAccount, @ComputerName, $AdminPassword, 0, @ComSpec & " /c Z:\MyProgram\install.exe" , @WorkingDir, @SW_MAXIMIZE,$STDOUT_CHILD)

Thanks

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