Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run software as administrator through the command prompt

Status
Not open for further replies.

xionhack

Technical User
Apr 25, 2009
24
US
Hello. I'm going to explain my whole case that way you can tell me what would be the best solution.


I have a .exe application that I want to install in about 500 computers. We have windows server 2003 in our servers. We dont have SMS and cannot afford it. I tried making the file an msi but it didnt work.


The file has command prompt options, so I can install it using commands through cmd. The way I was thinking about doing it was by making a script and put it in group policy, that would download the file to a temp folder and then would install it through the command prompt; the problem is that none of those computers have admin rights so they wont be able to install it.


I want to know if there is a way for me to install as admin through the command prompt by putting the info in the script or in another way. Please let me know how you think its best. We cannot really spend money in this, our other option would be to go computer by computer and install it. Thank you.
 
xionhack,

You are on the right track. Set the script to run(in the GPO) under the Computer Config as a Startup Script. It will run as the System account so no elevated rights are needed.

John
 
Would there be a problem if two computers try to access the file at the same time? Or if one computer wants to download the file while the other one is downloading it?
 
As long as they are just reading the file, there should be no issue. Problems surface when both need to write to it.

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
Here is the script, Im having a problem with it, I dont want it to install the program if it was installed before, maybe checking if the file was downloaded into the TEMP fiolder:


@echo off

echo ### Creating TEMP directory...
mkdir "C:\TEMP"


echo ### Downloading Software Manager
echo n|copy /-y "\\serverNETLOGON\setupInstall.exe" "C:\TEMP"


echo ### Installing Software manager
C:\TEMP\setupInstall.exe -server setup.server2.com -quiet
 
I only know some vbscript for this. This was not tested at all.

Code:
Set WshShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

File = "setupInstall.exe"
SourceLocation = "\\server\NETLOGON\"
DestinationLocation = "C:\TEMP\"  
Traget = "C:\TEMP\setupInstall.exe -server setup.server2.com -quiet"

'Check for folder or create it
If Not objFSO.FolderExists(strDestFolder) Then
	objFSO.CreateFolder(strDestFolder)
End If

If objFSO.FileExists("C:\TEMP\setupInstall.exe")=false Then
'Copy the file to PC
	objFSO.CopyFile SourceLocation & File, DestinationLocation & File , overwrite = False
'Run it
	WshShell run chr(34) & target & chr(34)
End If

MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top