Powershell SCCM client install toolkit. Download the script here.
- Should be a computer policy.
- Uninstall should happen before install.
- Always use Deploy-Application.ps1 and not Deploy-Application.exe from the Powershell SCCM client install toolkit (The technet article uses Deploy-Application.exe as the lanuncher, which then summons Deploy-Application.ps1. But in this case, we have to use Deploy-Application.ps1 directly)
Create a Group Policy Object. e.g. SCCM Client Re-Install Policy.
Create a SCOPE for the Group Policy Object. Remove all other scopes. The scope will be limited to an AD security group e.g. ‘SCCM-Client-Re-Install-AD-Group’
Now the group policy will only run on computers who are members of the above AD security group. In this case, ‘SCCM-Client-Re-Install-AD-Group‘ security group.
Create a Computer Policy start-up script. Select the PowerShell tab.
Browse and select the file Deploy-Application.ps1. The parameters will be <Start> -DeploymentType UnInstall -DeployMode silent <finish> without the <Start> and <Finish>. Priority 1
Now again, browse and select the file Deploy-Application.ps1. The parameters will be <Start> -DeploymentType Install -DeployMode silent -SMSCACHESIZE 10260 -SMSMP “FQDN-of-Management-Point” -SMSSITECODE “Your-Site-Code” -FSP “FQDN-of-Fall-back-Status-Point” <finish> without the <Start> and <Finish>. Fill-in all the server names with FQDN’s of the servers. Priority 2
Furthermore one can add POSH scripts like this to remove the computer automatically from the AD group ‘Sccm-Client-Re-Install-AD-Group’. For doing so, give domain computers access to change membership of the AD group.