Jump to content
Sign in to follow this  

Run an installer as Admin from network drive

Recommended Posts



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


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


Can anyone please guide me thru?


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"



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


Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.