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

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:

Copy-Item -Path ".\Client" -Destination "c:\windows\temp\intunetemp" -Recurse

c:\windows\temp\intunetemp\ccmsetup.exe /nocrlcheck /source:c:\windows\temp\intunetemp CCMHTTPSSTATE=31 CCMHOSTNAME=SCCM.CLOUDAPP.NET/CCM_Proxy_MutualAuth/72057594037928694 SMSSiteCode=PS1 AADTENANTID=4007305e-1664-4e6b-c9a4-c3d5ccfd1524 AADCLIENTAPPID=6g4a28b2-9d0a-482d-8553-7cb0d4897512 AADRESOURCEURI=https://ConfigMgrService

$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 (it could be peanuts as well Smile but still ) and also the time that it takes for download .

Hope it helps!

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

  1. 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
      1. 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

Leave a Reply