Solved

SCCM 2012 - Incorrect function on scripted install deployment

Posted on 2014-12-08
5
2,432 Views
Last Modified: 2015-01-02
I am using SCCM 2012 to deploy some applications.  I am having issues with one of them not deploying.  I keep getting "installation failed"  " Incorrect Function".  Its a simple batch file that creates a folder in C:\program Files(x86) and copies files to it .  Thats it.   I have tried doing a straight up file copy, I have tried using psexec to run it with elevated credentials etc.. but nothing is working.  Please look below and let me know what I am doing wrong?  Makes no sense:

I have tried so far:

@echo on

CD /d %~dp0

%~dp0psexec.exe -u **\ -p *** -h -i cmd /c mkdir "%ProgramFiles(x86)%\UMAX\"

COPY /Y %~dp0Files\*.* "%ProgramFiles(x86)%\UMAX"
GOTO END

:End
   @Echo ON
   Exit

Open in new window

0
Comment
Question by:Chad Franks
  • 2
  • 2
5 Comments
 
LVL 79

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 40487048
unless you change the permissions for c:\program files (x86) you will have problems since only TrustedInstaller has the necessary rights to this protected area. you could use the -s parameter to run as 'system' And System has the highest privileges on any computer
0
 
LVL 17

Expert Comment

by:Mike T
ID: 40489329
Hi,

I'm guessing it's permissions and the unhelpful error from the bat file is because BAT files are not suited to silent deployment or SCCM in general. Please avoid them. Use PowerShell instead.

Why are you trying to manually write files to Program Files anyway? What application do you have that has no installer? It doesn't bode well.

Mike
0
 
LVL 22

Expert Comment

by:Adam Leinss
ID: 40494076
Batch files work fine with SCCM...I use them all the time.

1. If you try these commands from an elevated command prompt at the console by hand, do they work?
2. Are you running the program under Admin mode in the program settings in SCCM?

SCCM will run your batch files from ccmcache on the C: drive of the client, so it will assume that is the working path, so I don't know that you need all the %~dp0s.
0
 
LVL 17

Expert Comment

by:Mike T
ID: 40494160
Hi Adam/Chad

Yes, I know BAT files work. I never said they don't - just that they are not suited. The trouble comes when they don't work. They don't trap errors, they can crash without sending any error code and they are very old technology.
You *could* put lots of error trapping in but it would take time which is better spent elsewhere.


Both VBS and Powershell have better error handling built-in to them. The other problem is that people get mixed up over paths and sticking %~dp0s because they don't understand path'ing in CM and because "that's the way they've always done it." It works in login scripts and from network shares but don't expect it to work from everywhere.

My point is simple: you will save a lot of grief switch to VBS or PowerShell now rather than later as CM is now very PowerShell aware.

File copy
A better file copy is already available here: http://blog.coretech.dk/mip/making-file-copy-easy/
You need to create a package and then add it to a Task-sequence.
Copyright and thanks go to Michael Petersen


I still don't like the idea of manually copying files to Program files either. If the vendor has left something out that you have to do post install tweaks then they are slacking and makes me wonder what else they have got wrong.

Mike
0
 
LVL 22

Expert Comment

by:Adam Leinss
ID: 40494210
He's copying a file to a folder...I don't think PowerShell is necessary in this case.  We are of course assuming that he has Powershell loaded on all of the computers in his environment and that the ability to run such scripts is allowed, etc.  WSH and the command interpreter are pretty much universal to Windows since Windows XP (circa 2001).
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

867 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

19 Experts available now in Live!

Get 1:1 Help Now