Solved

batch file error using sccm 2007

Posted on 2015-01-20
9
119 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
  • 4
  • 3
  • 2
9 Comments
 
LVL 23

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 16

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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 16

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 23

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 16

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Samba is the de-facto standard program (or, more correctly: suite of programs) that UNIX and Linux systems use to share files with Microsoft Windows (and more recently, Mac OS-X) systems. Currently, there are 2 common versions of Samba available,…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now