I'm deploying packages through SCCM. Most come in .msi format which is easy with a simple silent install command. At work we have ImageNow 6.6 and now the ImageNow team wants me to push out an update which fixes a known bug that causes the application to crash from time to time. Unfortunely there is no msi file available so it came as an exe. I've done exe files before like per say FireFox where I utilize a simple "FireFox 15.exe" -ms command. But this one is being a little tricky.

When pushed via-SCCM as everyone knows it copies the files in the \CCM\Cache folder and from there the batch file should do its magic but it keeps failing. This is what I currently have:

@echo off
copy ClientSetup_6.6.0.exe %WinDir%\temp\
ping 123.0.0.1 -n 1 -w 180000 > nul

::start install and wait until completed to continue
start /WAIT %WinDir%\temp\ClientSetup_6.6.0.exe /s /v"IN_SERVER_NAME=servername /qb"

::clean up files
del %WinDir%\temp\ClientSetup_6.6.0.exe
exit

This is my original plan. I set it to where the ClientSetup_6.6.0.exe copies into the Windows temp folder. I threw in the "ping" command to give it a 3 minute time limit for the exe to copy over since it is 300MB in size. Once it is done copying, the exe should start installing and after it finishes, the exe gets deleted from the temp folder. Below are the problems I'm running into:

1. When I run the batch file as an admin, the copy command does not seem to work. The cmd pops up and it states the file "ClientSetup_6.6.0.exe file does not exist in temp folder". But when I run the batch file normal, I notice that the ClientSetup_6.6.0.exe appears under the temp folder, nothing executes and the exe file deletes itself from the temp folder.

2. So I began changing around the code a bit just to see if the exe file actually installs. So this is what I did.

@echo off

::start install and wait until completed to continue
start /WAIT %WinDir%\temp\ClientSetup_6.6.0.exe /s /v"IN_SERVER_NAME=servername /qb"

::clean up files
del %WinDir%\temp\ClientSetup_6.6.0.exe
exit

I removed the "copy" command. I then manually copied the ClientSetup_6.6.0.exe into the temp folder. When I run the batch file normal, nothing happens. But when I run the batch file as an administrator, everything works perfect! The exe file installs successfully updating the ImageNow client and then disappears from the temp folder as it suppose to.

So I'm a bit confused on what is going on. When I push out an application through SCCM usually the "Run with Administrator rights" option is enabled. So I'm afraid the batch file will completely fail either way. If anyone has any suggestions or alternatives other than using the batch file, I'll be very grateful. Maybe as easy where I can implement something in the command line under SCCM other than relying on the batch. Looking forward to a response.



Thanks,
Luis

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

3

@echo off
copy "%~dp0ClientSetup_6.6.0.exe" %WinDir%\temp\
ping 123.0.0.1 -n 1 -w 180000 > nul

::start install and wait until completed to continue
start /WAIT %WinDir%\temp\ClientSetup_6.6.0.exe /s /v"IN_SERVER_NAME=servername /qb"

::clean up files
del %WinDir%\temp\ClientSetup_6.6.0.exe
exit

will work if you are running this batch file as an administrator/the account which is having admin rights...

If you run this batch file using currently logged in user's previliges, then it will not work for the standard users as they don't have permission to modify anything in %WinDir%\Temp folder... and install the exe as well

Answered 09/14/2012 by: jagadeish
Red Belt

  • Thank You jagadeish! I used yours method and it worked perfectly as expected.
Please log in to comment

Answers

1

Change your commnd like this 

@echo off

if not exist " %WinDir%\temp" md "%WinDir%\temp"
xcopy ClientSetup_6.6.0.exe /y /e %WinDir%\temp\
ping -n 20 127.0.0.1 > NUL

::start install and wait until completed to continue
start /WAIT %WinDir%\temp\ClientSetup_6.6.0.exe /s /v"IN_SERVER_NAME=servername /qb"

::clean up files
del /s /q %WinDir%\temp\ClientSetup_6.6.0.exe
exit

Answered 09/14/2012 by: ontari.ontari
Black Belt

  • IN XCOPY give your location where you are running it from like xcopy "C:\Source" /y /e "C:\Destination"
Please log in to comment
1

Hold up - you mention it's an executable (exe) but your command line shows that you are in fact passing parameters to msiexec.

The /v tells the setup exe to pass the IN_SERVER_NAME public property and /qb to the msi that is being extracted and run.

Extract the exe with your favourite archive program, or failing that launch the exe and check your temp folder and grab the MSI.

Deploy as you normally would an MSI with the public property on the command line or in an MST.

 

Hope that helps,

Dunnpy

Answered 09/17/2012 by: dunnpy
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share