SCCM Client Replacement using PowerShell and CMG
SCCM Client, CMG, Intune, PowerShell

SCCM Client Replacement using PowerShell and CMG

I'll try to post more such PScript in future to automate and combine small tasks. Hopefully someone out there is looking for such solutions :)

So after completing the SCCM Migration, one of the last steps is to migrate the clients, and there is no better way than uninstalling the old client and reinstalling the new one (Site code change is also a method but we'll talk about that in another post).

I believe most of us now have internet connected clients which makes the the good old client push method unusable or difficult to use.

So to overcome this situation I decided to write a PowerShell script, below is the logic of this script:

  1. Detecting the installed client and verifying if it is of the old environment, using the registry key method to detect the site code.

  2. Uninstalling the client if the site code is found to be from old environment.

  3. Monitoring and verifying the uninstall completion.

  4. Downloading the new client from an Azure blob storage.

  5. Running the install command line with CMG arguments.

  6. Wait for the ccmsetup to complete and give a success message in the log.

Modify the script according to your need, below are the values you should change as per your environment:

Lines 44,45 & 46 - change the Site code as your old environment.

Line 65 - your blob location for the ccmsetup.exe file

Line 66 - change the destination location if you want it to be different

Line 73 - write the CMG client installation argument as per your new site.

Line 82 - change the wait time according to your need. Currently the Start -sleep is set to 30 seconds and the counter limit is set to 60 so the total wait time is 30 minutes.

Hot like and share it, if you liked the idea and want me to create more such stuff (I'll post anyway :D)!

So share your suggestions and ask me if you have any queries, I'll be glad to help!

Until the next post! Ciao!

Sean Enright

Systems Administrator at Progress

6mo

I would like to provide some input, if you already have sccm installed, you dont need all these steps, you can do it in 1 go. We had to change CMG servers and needed to update remote devices not connected to our network. Worked for me just now! See the script here. https://eskonr.com/2020/05/how-to-prepare-sccm-cmg-client-installation-switches-for-internet-based-client/

Raju Allagadda Pamula

Associate System Administrator at Tech Mahindra

1y

I'm interested

PŘABHAKAR MISHRA

Solution Owner | SCCM Architect | Endpoint Mobility - Security | MDM | Intune | Azure | Autopilot | M365 | MECM

1y

I need your help.

Yvette Perrin

Customer Service Program Manager | HP Managed Solutions

1y

Always on top Abhishek 😉 good job

Nitin Raina

DDI SME (DNS | DHCP | IPAM) at Jio Platforms

1y

Great article !!

To view or add a comment, sign in

Others also viewed

Explore topics