Solved

SCCM 2012 - Incorrect function on scripted install deployment

Posted on 2014-12-08
5
2,164 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 78

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 16

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 16

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
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 two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

746 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

9 Experts available now in Live!

Get 1:1 Help Now