Solved

batch file error using sccm 2007

Posted on 2015-01-20
9
127 Views
Last Modified: 2015-02-11
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...
0
Comment
Question by:joe wade
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 24

Expert Comment

by:Nagendra Pratap Singh
ID: 40561214
Sounds like a permission issue on the share.

put exception.sites in the package and copy it.
0
 
LVL 18

Expert Comment

by:Mike T
ID: 40561708
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
0
 

Author Comment

by:joe wade
ID: 40561729
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
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:joe wade
ID: 40562171
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...
0
 
LVL 18

Expert Comment

by:Mike T
ID: 40563361
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
0
 
LVL 24

Expert Comment

by:Nagendra Pratap Singh
ID: 40563577
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.
0
 

Accepted Solution

by:
joe wade earned 0 total points
ID: 40564278
I finally got the program to install by using the following

Within SCCM, selecting Create new package from definition.

If I then select the msi, SCCM then creates the package.

If I look under the programs created, I open the program " per-system unattended " and copy the command line -

msiexec.exe /q ALLUSERS=2 /m MSIXHPRU /i "%~dp0SiteCTRLSetup.msi"

This command line is then placed in the batch file  Kramer.cmd and I use this batch file as the program.

Installation is then fine.

I suspect that the Kramer site ctrl application does not like the content within the earlier batch file.
0
 
LVL 18

Expert Comment

by:Mike T
ID: 40564468
Glad you got it working. I just prefer to avoid BAT files altogether these days for examples like this.
0
 

Author Closing Comment

by:joe wade
ID: 40602753
The msi was altered by myself and all is now running fine
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, As I have seen there a lot of requests regarding monitoring and reporting for exchange 2007 / 2010 / 2013 I have decided to post some thoughts together and link to articles that have helped me. Of course a lot of information you can get…
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question