SCCM 2012 / Software Center / Copy published file to a folder under user profile

Posted on 2014-08-21
Last Modified: 2014-09-16
Hi, SCCM 2012 and Software Center.

I'm trying to get an optional file copied for users if they need it. The idea was to publish it through Software Center as available software as a simple file copy bat file. Depending on the software/OS version the file can end up in three different directories.

IF EXIST "C:\Program Files (x86)\Folder" (copy /y "" "C:\Program Files (x86)\Folder")
IF EXIST "C:\Program Files\Folder" (copy /y "" "C:\Program Files\Folder")
IF EXIST "%userprofile%\AppData\Local\Folder" (copy /y "" "%userprofile%\AppData\Local\Folder")

First two work but I assume that SCCM runs the batch file with system context so that %userprofile% variable is not understood.
Is there any alternative way to copy the file to a folder under users profile folder?
Question by:TroubledWay
    LVL 23

    Accepted Solution

    You can change it to run without using system context.

    The first link mentions 2007 version but the concept is the same.

    Author Closing Comment

    Sorry for the long delay. This looks like it could do the trick. Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
    Understanding the various editions available is vital when you decide to purchase Windows Server 2012. You need to have a basic understanding of the features and limitations in each edition in order to make a well-informed decision that best suits y…
    In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
    In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.

    760 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

    11 Experts available now in Live!

    Get 1:1 Help Now