Hello
I have a simple bat file that copies a license file to a folder

Batfile:
@Echo Off 
Copy %~dp0xxxxxxxx.xml %appdata%\xxxxx.folder /Y
exit

Gwpa7P.pngQhi0il.png


Error in AppEnforce.log:
++++++ App enforcement completed (0 seconds) for App DT "XXXXXXXXXXXXXXXXXXXX" [ScopeId_689C2AAF-32C9-4D4E-9E68-27943BB05228/DeploymentType_18e9fd30-04dd-423f-bbfb-cd68227458d7], Revision: 5, User SID: ] ++++++	AppEnforce	11-02-2016 08:54:47	15120 (0x3B10)
+++ Starting Install enforcement for App DT "XXXXXXXXXXXXXXXXXXXX" ApplicationDeliveryType - ScopeId_689C2AAF-32C9-4D4E-9E68-27943BB05228/DeploymentType_18e9fd30-04dd-423f-bbfb-cd68227458d7, Revision - 7, ContentPath - C:\WINDOWS\ccmcache\o, Execution Context - System AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    A user is logged on to the system. AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Performing detection of app deployment type XXXXXXXXXXXXXXXXXXXX(ScopeId_689C2AAF-32C9-4D4E-9E68-27943BB05228/DeploymentType_18e9fd30-04dd-423f-bbfb-cd68227458d7, revision 7) for system. AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
+++ Application not discovered. [AppDT Id: ScopeId_689C2AAF-32C9-4D4E-9E68-27943BB05228/DeploymentType_18e9fd30-04dd-423f-bbfb-cd68227458d7, Revision: 7] AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    App enforcement environment: 
Context: Machine
Command line: "InstallAndActivate.bat"
Allow user interaction: No
UI mode: 1
User token: null
Session Id: 2
Content path: C:\WINDOWS\ccmcache\o
Working directory: AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Prepared working directory: C:\WINDOWS\ccmcache\o AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Prepared command line: "C:\WINDOWS\ccmcache\o\InstallAndActivate.bat" AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Executing Command line: "C:\WINDOWS\ccmcache\o\InstallAndActivate.bat" with user context AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Working directory C:\WINDOWS\ccmcache\o AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Post install behavior is BasedOnExitCode AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Waiting for process 13772 to finish.  Timeout = 120 minutes. AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Process 13772 terminated with exitcode: 0 AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Looking for exit code 0 in exit codes table... AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Matched exit code 0 to a Success entry in exit codes table. AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
    Performing detection of app deployment type XXXXXXXXXXXXXXXXXXXX(ScopeId_689C2AAF-32C9-4D4E-9E68-27943BB05228/DeploymentType_18e9fd30-04dd-423f-bbfb-cd68227458d7, revision 7) for system. AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
+++ Application not discovered. [AppDT Id: ScopeId_689C2AAF-32C9-4D4E-9E68-27943BB05228/DeploymentType_18e9fd30-04dd-423f-bbfb-cd68227458d7, Revision: 7] AppEnforce 11-02-2016 09:47:27 10396 (0x289C)
++++++ App enforcement completed (0 seconds) for App DT "XXXXXXXXXXXXXXXXXXXX" [ScopeId_689C2AAF-32C9-4D4E-9E68-27943BB05228/DeploymentType_18e9fd30-04dd-423f-bbfb-cd68227458d7], Revision: 7, User SID: ] ++++++ AppEnforce 11-02-2016 09:47:27 10396 (0x289C)


If i do a Packet instead of an application the script works, but want it to be a application, due to it is part of a larger installation and there is no check in a Packet to my knowledge?.

Looking forward to your help.

/Emort




0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0
It looks like your path is incorrect - it has an exclaimation mark next to the line.

It could be that you're just missing the leading '%' at the beginning of appdata - '%appdata%\xxxxxfolder' - or it could be that this variable isn't recognised by SCCM.

This post seems to indicate this (but it is a few years old now and for an earlier version) and offers a script that mitigates the limitation.

Is the script running and placing the file correctly?
Is it just the detection method that's failing, or the script and detection?

Dunnpy
Answered 02/11/2016 by: dunnpy
Red Belt

  • Hi Dunnpy
    thanks for your response!

    The missing % is a type o , tried to be all anonymous (stupidity)

    no, it does not copy the file (works if i run the bat from the "c:\Windows\ccmcache"

    hmm can't fine any office statement?
Please log in to comment
0
So if the script isn't running on the initial deployment (for the detection method to work afterwards) - what context are you running the script in?

It will need to be run as the user and per user (not system) to be able to access the %appdata% path in the correct context of the currently logged in user.
It will also need to run for each user that logs in, if they require the licence file for the software to be in a user profile location.

If the software is licenced per-user, then that is how it will have to be, if it's per-machine then you may be able to alter the location it examines for the licence file and place it in a machine specific location - meaning that it only has to be dropped once.

This would make your detection easier and will reduce the overhead of having to drop the file in on a per-user basis.


Dunnpy

Just as an afterthought - you could add some error trapping into your batch file, with an IF EXIST after the file copy to verify that it's there and trap the exit code that SCCM receives back to assist with troubleshooting.
Answered 02/11/2016 by: dunnpy
Red Belt

  • Hi Dunnpy
    what you say makes sence..

    the following is set under "user experience"
    installation behavior: "Install for user"

    so i take it that %appdata% should work?
    • also out in a pause to see if the scripts starts
    • I've just spotted in the log that the script is being run as the system context - not the currently logged in user. If the %appdata% variable is accepted by the dialogue - then the exlaimation mark should disappear.
Please log in to comment
Answer this question or Comment on this question for clarity