Close Menu
    Facebook X (Twitter) Instagram
    Sunday, October 12
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CMG»Using intune to install ConfigMgr client as win32 app using local source files without downloading from CMG

    Using intune to install ConfigMgr client as win32 app using local source files without downloading from CMG

    Eswar KonetiBy Eswar KonetiDecember 22, 10:16 am4 Mins Read CMG 8,092 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Few months ago i blogged about How to install SCCM client using win32 apps in Intune for co-management and CMG .when you create a win32 app for ConfigMgr client with the command line switches as said in the blog post, ccmsetup.exe will always get the source files from CMG.

    The download of the client files from CMG happens due to the parameter /mp. This parameter will help client to download the content from the nearest distribution point. we want to avoid client to download client files from CMG and always use local source files (win32 app) that was downloaded from intune.

    why do you need to use the local source files to install client instead of downloading from CMG? If you read the Microsoft article for CMG, Charges are based on data flowing out of Azure (egress or download). Any data flows into Azure are free (ingress or upload). So when client download source files of 240mb, there will be cost involved and if there are 5000+ clients download the data, this sums up to Terabytes and when you have already have source files locally available, why do you need to download from CMG again?

    In this blog post, we will see how to install configuration manager client using IME cache data that is downloaded from intune without connecting to CMG.

    Before we create win32app or make changes to command line switches, we first need to understand how to use offline source files.

    Here is the powershell script that will do all the magic here.

    we first copy the Configmgr client folder to c:\windows\temp\intunetemp and run the ccmsetup.exe with /source switch and other command line that will help client to assign to site.

    we will try this until the ccmexec (SMS Agent host) service is installed (you can use other ways as well like registry etc.) to confirm configmgr client installed successfully.

    If the ccmexec service installed then return code 0 else 1 after 5 retries with wait of every 60 sec.

    Powershell:

    <#
    Name: Install SCCM Client 2303 using offline source files
    Author: Eswar Koneti
    For more information about command line switches https://eskonr.com/2020/05/how-to-prepare-sccm-cmg-client-installation-switches-for-internet-based-client/
    Creation of win32 app https://eskonr.com/2019/12/using-intune-to-install-configmgr-client-as-win32-app-with-local-source-files-without-downloading-from-cmg/
    #>
    # Define the folder
    $folderPath = "c:\windows\temp\intunetemp"
    # Check if the folder exists, if not, create it
    if (-Not (Test-Path -Path $folderPath -PathType Container)) {
    New-Item -ItemType Directory -Path $folderPath -Force
    }
    Copy-Item -Path ".\Client" -Destination $folderPath -Recurse
    c:\windows\temp\intunetemp\client\ccmsetup.exe /nocrlcheck /source:c:\windows\temp\intunetemp\client CCMHOSTNAME=SCCM.CLOUDAPP.NET/CCM_Proxy_MutualAuth/72057594037928694 SMSSiteCode=PS1
    $retry = 0
    while($retry -lt 5)
         {
    $service= get-service -name CcmExec
    if($service)
               {
    exit 0
               }
    else
               {
    start-sleep -s 60
    $retry ++
    write-output "Retrying $retry"
               }
              }
    exit 1

    With this PowerShell script, we will now generate win32app in intune and assign it to the device group.

    1. Create a folder called ConfigMgrclient (C:\ConfigMgrclient)

    2.Copy the client files into ConfigMgrclient (C:\ConfigMgrclient\Client)

    3. Save the above PowerShell script as install.ps1 into (C:\ConfigMgrclient). Don't forget to change the parameters in the ccmsetup.exe command line above.

    4.Create an empty text file with name cmclient.txt (C:\ConfigMgrclient)

    5.Download win32 app packaging tools from here

    Now your folder content looks like this:

    image

    5.Open command prompt and go to win32 app packaging directory and run  IntuneWinAppUtil.exe

    6.Please specify the source folder:C:\ConfigMgrclient

    7.Please specify the setup file:Install.ps1

    8.Please specify the output folder:C:\ConfigMgrclient

    image

    To create win32 app, login to device management portal or azure portal and go to intune, client apps, add new app as win32

    select app package file that we created above

    install command: powershell.exe -exec bypass -file .\install.ps1

    uninstall command: C:\windows\ccmsetup\ccmsetup.exe /uninstall

    image

    Requirements: you can choose as per your infra requirement.

    Detection rule, registry key:

    Key path:Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client

    Value Name:ProductVersion

    image

    save the app

    Go to assignment and add device security group or autopilot AD sec group that you created to install client.

    When you deploy the client to devices, ccmsetup.exe will download the files from C:\windows\temp\intunetemp folder.

    clip_image001

    with this, we managed to save cost for downloading the content from CMG and also the time that it takes for download .

    Hope it helps!

    cloud management gateway cmg configmgr intune local source files MEMCM PowerShell Script win32 win32app
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Export Microsoft Entra ID User Authentication Methods to CSV using PowerShell & Microsoft Graph API

    August 13, 2:08 pm

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    Automating Intune Deployment Rings Using Entra ID Dynamic Groups and Regex

    July 01, 10:31 pm

    8 Comments

    1. Tim Landers on April 15, 2022 5:54 AM

      I modified the script a bit after some failed attempts.
      Try incorporating these changes (check for folder, check for ccmsetup and then ccmexec).
      ____________
      If(-not(Test-Path "c:\windows\temp\intunetemp")){ md 'c:\windows\temp\intunetemp' }
      Copy-Item -Path ".\Client" -Destination "c:\windows\temp\intunetemp" -Recurse

      If(-not(Test-Path "C:\Windows\temp\intunetemp\Client\ccmsetup.exe")){ exit 10 }

      c:\windows\temp\intunetemp\client\ccmsetup.exe /nocrlcheck /source:c:\windows\temp\intunetemp\client CCMHTTPSSTATE=31 CCMHOSTNAME=/CCM_Proxy_MutualAuth/72057594037928694 SMSSiteCode= AADTENANTID= AADCLIENTAPPID= AADRESOURCEURI=https://

      $retry = 0
      while($retry -lt 2)
      {
      $service = get-service -name Ccmsetup
      if($service)
      {
      $retry = 3
      }
      else
      {
      start-sleep -s 60
      $retry ++
      write-output "Retrying $retry"
      }
      }

      $retry2 = 0
      while($retry2 -lt 5)
      {
      $service = get-service -name CcmExec
      if($service)
      {
      exit 0
      }
      else
      {
      start-sleep -s 60
      $retry2 ++
      write-output "Retrying $retry2"
      }
      }
      exit 1

      Reply
      • Eswar Koneti on April 26, 2022 3:23 PM

        Hi Tim,
        Thanks for sharing the information, and is useful for others.

        Thanks,
        Eswar

        Reply
    2. Jonathan on February 12, 2021 11:27 PM

      Im confused what the empty CMclient.txt file is for? Its not referenced in the script or anywhere else. Typo?

      Reply
      • Eswar Koneti on February 13, 2021 4:25 PM

        Hi Jonathan,
        Yes, it is typo. please ignore it ,and thanks for the notice 🙂

        Regards,
        Eswar

        Reply
    3. Mohammed Kaif on May 5, 2020 10:47 PM

      Nice Post buddy.
      Just wanted to understand what did you mean by install ccmsetp.exe with /source and other switches to assign it to site.

      Reply
      • Eswar Koneti on May 6, 2020 3:09 PM

        Hi,
        the switches i was referring to the ccmsetup.exe available in configuration manager documentation https://docs.microsoft.com/en-us/mem/configmgr/core/clients/deploy/about-client-installation-properties

        Thanks
        Eswar

        Reply
        • Mohammed on May 6, 2020 3:20 PM

          Actually I wanted to know if we have to manually install the client in the machine from the temp folder and then use the powershell script.

          Reply
          • Eswar Koneti on May 6, 2020 6:37 PM

            Hi.
            If you are using intune to deploy the client and do co-mgmt,you can follow the blog post.
            if you want to install client manually and without need of intune, then you can follow this blog post http://eskonr.com/2019/07/how-to-install-sccm-client-from-microsoft-intune-for-co-managed-and-cmg-notes-from-the-field/ where i talked about how to install the client manually

            What is your request here?

            Thanks,
            Eswar

            Reply

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2025 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.