Solved

batch file error using sccm 2007

Posted on 2015-01-20
9
126 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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,…
Goal:  To set up a secure SSH server for your home computer to make it accessible anywhere AND to use it as a port forwarding proxy. Steps 1.  WinSSHD version 5 is free for personal use.  So download and install it.  You can download it from the…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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