I am trying run a batch file to my Windows 7 (x64) client with SCCM 2007. Most of the apps (which are all msi installs) apart from 3 which I am calling using .cmd files.

Looking at the deploy logs I can see that the database returns the correct package_id and the correct .cmdfile is being run and it even returns a status of successful.

Below is an example of one of the .cmd files I am trying to run. The %~dp0 means from the current location, so I wouldn't have thought it would be a problem with UNC paths. The files copies successfully to the path but the installert doesn't run. Here the script template:

copy "%~dp0*.*" "c:\users\default\appdata\local\temp\"
start c:\users\default\appdata\local\temp\setup.exe /s /SMS


If I run the .cmd file manually from the client, it works -but not from my "Run Command Line" step i the Task Sequence.

Could somebody help me with this script?

Best regards,
Kenny
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Try setting the Program's Environment to 'Requires drive letter'. It won't work if it's a UNC.
Answered 08/30/2011 by: michaelnowell
Second Degree Blue Belt

Please log in to comment
0
Hi Michael and thanks for the quick response!

Could you please give me an example of setting Program's Environment to 'Requires drive letter?

The command successfully copies the setup.exe, setup.iss etc. to c:\users\default\appdata\local\temp\ at the clients, but someting is missing in the start command. SCCM gives me a successfully error code, but I think the installerer just can't find the right working directory.

Best regards,
Kenny
Answered 08/30/2011 by: KennyBrez
Senior Yellow Belt

Please log in to comment
0
[font="courier new"][font="times new roman"]I don't quite understand that copying part. Task Sequence copies data to the client. Anyway I would try adding the /wait option to the start command:

start "" /wait [font="courier new"]setup.exe /s /SMS
[font="times new roman"]
--
Mikko Järvinen
Answered 08/30/2011 by: mikkojarvinen
Senior Yellow Belt

Please log in to comment
0
Thanks Mikko,

OK, tried:

copy "%~dp0*.*" "c:\users\default\appdata\local\temp\"
start "" /wait c:\users\default\appdata\local\temp\setup.exe /s /SMS


It starts, but just aborts with no install :-(

Best regards,
Kenny
Answered 08/31/2011 by: KennyBrez
Senior Yellow Belt

Please log in to comment
0
you could try your script like this:

pushd %~dp0
copy /Y *.* "c:\users\default\appdata\local\temp\"
start "" /wait c:\users\default\appdata\local\temp\setup.exe /s /SMS

I added the /Y just to avoid annoying prompts

Another option might be to let SCCM handle the local caching of the files by setting the option in your advertisement (distibution points tab - Download content and run locally). This assumes that the setup.exe only has to anywhere on the local machine, and not specifically in that exact folder, and just running the setup in the cmd without the extra filecopy like

pushd %~dp0
start "" /wait setup.exe /s /SMS

Hope this helps,

PJ
Answered 08/31/2011 by: pjgeutjens
Red Belt

Please log in to comment
0
If I run the .cmd file manually from the client, it worksRemember that SMS/SCCM installs using the local System account. Does it run when you run it as the local System account? Use the old 'AT /INTERACTIVE' dodge to get a command prompt as local System, then try. I'd wager it will fail.

In that case, I'd investigate whether the EXE extracts and executes an MSI. If it does, great - create a response transform and use the combination to install. If not, re-package it.
Answered 08/31/2011 by: VBScab
Red Belt

Please log in to comment
0
"Run Command Line" step i the Task Sequence ORIGINAL: KennyBrez

Maybe your command line does not work in task sequence, one possibility is that your package requires a user profile. In SCCM R2 you can set your commandline to run as a user. There are usually 1 or 2 domain user accounts configured in AD for TS, try running it as those users, or use a variable to run it as localadmin.
Btw this post belongs to SCCM section.
Answered 08/31/2011 by: admaai
Orange Senior Belt

Please log in to comment
0

I know this is an old question, but has anyone tried the cmd /c copy? I have several packages in our environment, which require copy (icon.dll's, etc), and I have had great success using this command. May also want to run as a second program to get the program to actually run. Maybe build a package with the program run as a dependent variable set task variable of the copy program and put them in the task sequence (3 steps reuired: one defining each variable, and one starting the set task sequence variable sequence. Hope this makes sense/helps someone.

Answered 08/24/2013 by: randboten
White Belt

Please log in to comment
Answer this question or Comment on this question for clarity