Link to home
Start Free TrialLog in
Avatar of joe wade
joe wade

asked on

batch file error using sccm 2007

Hello,

I want to install a program using SCCM 2007. I want SSCM to run the associated msi and copy a file from the same location of the msi to the c: drives of 15 or so win 7 clients.

The msi and file are on a network share.

the batch file is as below -

msiexec.exe /i “%~dp0sitectrlsetup.msi” /q
 
COPY /Y “%~dp0exception.sites" "C:\Users\%username%\AppData\LocalLow\Sun\Java\Deployment\security"

kramer.cmd is the name of the batch file.

The syntax of the above was copied from another package within SCCM ( flash installation ) which I know works.

I have altered the text to reflect what I want to install.

The package, program, distribution point, advert and collection have been configured, and are as i would expect.

The batch file ( kramer.cmd ) is in the same directory as the msi & the single file to be copied.

Within SCCM, software distribution reports, I am informed that the clients receive the program, but the clients fail to run the program as they cannot find the file specified or the report suggests there is a ' bad environment '

If i have SCCM configured to run just the msi ( not as part of a batch file...) the program executes fine.

This should be simple to execute but I just cannot get it to run.

What am I doing wrong ?

Thanks...
Avatar of Nagendra Pratap Singh
Nagendra Pratap Singh
Flag of Australia image

Sounds like a permission issue on the share.

put exception.sites in the package and copy it.
Hi,

The bit:
The msi and file are on a network share.
is a red herring as far as ConfigMgr is concerned.

ConfigMgr doesn't care if you put it there as it will use it's package source. Another implication of this is the good old batch file trick %~dp0 is not required. It does work (as your Flash package does) but it doesn't seem to be reliable.

Try taking the %~dp0 pathing out of the CMD (and redistribute the package).

If that fails I would use a TS and set the package. This just has 2 steps - install MSI and copy file and because you are referencing the package SCCM will find the file.

Mike
Avatar of joe wade
joe wade

ASKER

Hello Mike and thanks.

The batch file has now been pared down to read -

msiexec.exe /i sitectrlsetup.msi /q

I want to see if this simple command is called and executed.

I have updated the distribution point

I will refresh the collection shortly and see what happens
If I have the Kramer.cmd file written as follows -

msiexec.exe /i "%~dp0sitectrlsetup.msi" /q

or

msiexec.exe /i sitectrlsetup.msi /q

either way, a successful installation does not result.

If I go to C:\Windows\SysWOW64\CCM\Cache I see the .msi file and .cmd file have been copied down.

I am convinced this error must be related to permissions or how I have configured the package in SCCM to run this .cmd file.

Two other simple packages in SCCM calling a .cmd file to install, for example -

"%~dp0Homer268Beta.exe" /verysilent

AND...

MD C:\Dropbox

"%~dp0Dropbox_2.0.26.exe" /S /D=C:\Dropbox

copy /y "%~dp0Dropbox.lnk" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Dropbox.lnk"

Have executed fine on the client.

Thanks...
Hi Joe,

The problem is subtle path-ing issue I believe. I just checked and found a blog who uses this format

msiexec.exe /i %~dp0\Java7Update21_x86\jre1.7.0_21.msi /passive /norestart /l*v c:\windows\temp\Java7x86.log

Note, he has not quotes and has a \ after the ~dp0. I normally use this style but without the %~dp0 as I said already. If you look at the logs you would see what exactly command-line SCCM is using and will then know what's wrong. From memory the log you need is execmgr.log.

If it was security the client would never get the files into the cache in the first place as they would get access denied.

Mike
Open your execmgr.log after the installation has finished/failed.

You should find the full command that was executed (msiexec.exe /i sitectrlsetup.msi /q etc).

Maybe you can spot an error there. Try to run the same command manually to see if it works . For this you need to take the command from execmgr.log and remove the /q switch. You should also add a log file at the end with verbose logging enabled.
ASKER CERTIFIED SOLUTION
Avatar of joe wade
joe wade

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad you got it working. I just prefer to avoid BAT files altogether these days for examples like this.
The msi was altered by myself and all is now running fine