Solved

batch file error using sccm 2007

Posted on 2015-01-20
9
125 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 17

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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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 17

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 17

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Sometimes when I receive a call from my users to solve their problems it is very difficult for me to found their computer IP address. Even finding their computer Host to provide remote support can be a problem.  So I resorted to Goo…
This is a fairly complicated script that will install the required prerequisites to install SCCM 2012 R2 on a server.  It was designed under the functional model in order to compartmentalize each step required, reducing the overall complexity.  The …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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