File copy using Win32 App failes

IMK 551 Reputation points
2024-05-22T18:16:37.0533333+00:00

Hi

I am trying to place "Default Template.potx" file to "%appdata%\Microsoft\Templates\Document Themes" folder using Intune/Win32App and have been testing this.

I have created a .bat file, which contains copy syntax.

If I use

copy DefaultTheme.potx C:\Temp

syntax in .bat file, it works. But if I use

copy "Default Theme.potx" "%appdata%\Microsoft\Templates\Document Themes"

or

copy "Default Theme.potx" "%APPDATA%\Microsoft\Templates\Document Themes"

syntax in .bat file, it fails.

What am I missing?

Microsoft Intune Application management
Microsoft Intune Application management
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Application management: The process of creating, configuring, managing, and monitoring applications.
961 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Crystal-MSFT 49,601 Reputation points Microsoft Vendor
    2024-05-23T01:39:12.52+00:00

    @IMK, Thanks for posting in Q&A. For Win32 app, it has a setting named "Install behavior". when it is set as system, it will run under system account. When it is set as user, the command will run under currently logging user. For different user, the variable "%appdata%" will be different.

    https://learn.microsoft.com/en-us/mem/intune/apps/apps-win32-add#step-2-program

    To make iWin32 work, the command needs to be able to run successfully on the device side before we deploy it. You can manually test the command on one affected device to see if it works. For example, if the above setting is set as user, we can test on current logging user. For system account, you can use PsExec tool to run as system account to test.

    https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

    Hope the above information can help.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Pavel yannara Mirochnitchenko 12,611 Reputation points MVP
    2024-05-23T06:56:36+00:00

    I would really encourage you to start using Powershell for application scripting instead of .bat / cmd. Just a hint :)

    0 comments No comments

  3. IMK 551 Reputation points
    2024-05-23T10:11:04.5833333+00:00

    Hi

    I have

    C:\CustomTheme\Source

    folder, where I have "Default Template.potx" file and "CustomTheme.bat" file.

    Näyttökuva 2024-05-23 123537

    CustomTheme.bat file content is

    copy "Default Theme.potx" "%APPDATA%\Microsoft\Templates\Document Themes"
    

    If I run this bat file from this location in the target device, it works normally. I have also removed the .potx file from Document Themes -folder after this test, so it won't interfere testing.

    I have created "CustomTheme.intunewin" file using IntuneWinAppUtil.exe tool, that I downloaded from GitHub with following settings.

    Näyttökuva 2024-05-23 123414

    Näyttökuva 2024-05-23 123657

    Next, I go to Intune -> Apps and start to create new Win32 App.

    Näyttökuva 2024-05-23 124144

    I add the app package file (CustomTheme.intunewin) from the C:\CustomTheme\Output -folder.

    Näyttökuva 2024-05-23 124245 I name the app.

    Näyttökuva 2024-05-23 124416Set Program settings.

    Näyttökuva 2024-05-23 130240Set requirements.

    Näyttökuva 2024-05-23 130328

    Set detection rule.

    Näyttökuva 2024-05-23 130449

    I place nothing for dependencies or supersedence, assing Required to All Users with toasts on, Availability and Installation deadline as "As soon as possible", Restart grace period is Disabled and Delivery optimization priority is "Content download in backgroud".

    Here is the content of the Summary.

    Näyttökuva 2024-05-23 130808 Näyttökuva 2024-05-23 130901 Näyttökuva 2024-05-23 130951 Näyttökuva 2024-05-23 131023

    Result is that it fails.

    What is wrong?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.