Runing .cmd from SCCM 2007 ("%~dp0)
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
Answers (8)
Please log in to answer
Posted by:
randboten
11 years ago
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.
Posted by:
michaelnowell
13 years ago
Posted by:
KennyBrez
13 years ago
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
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
Posted by:
mikkojarvinen
13 years ago
Posted by:
KennyBrez
13 years ago
Posted by:
pjgeutjens
13 years ago
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
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
Hope this helps,
PJ
Posted by:
anonymous_9363
13 years ago
Remember thatIf I run the .cmd file manually from the client, it works
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.
Posted by:
admaai
13 years ago
"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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.