Killing and reinstalling the Intune Client without user interaction

So, recently a customer installed the Intune client in an image, as my previous post details, causing the client to enter a bricked state.

Reinstallation of the client can fix this, but we wanted minimum user interaction as a large number of machines was already distributed.

For those who remember Winrar, it is a fantastic ZIP tool that can create a self-extracting archive (.EXE) which auto-self elevates (admin rights) and can automatically start a file from the archive after extraction.

Include the Intune setup file and the certificate Microsoft includes, and this script (as .bat), and your Intune installation will be ‘cleaned up’. Note that you may see some file protection dialogs.

Source code:

@ECHO OFF
REM IntuneClientResetter
REM Copyright:     Free to use, please leave this header intact 
REM Author:        Jos Lieben (OGD) 
REM Company:       OGD (http://www.ogd.nl)
REM Purpose:       This script will reset the intune client
REM Assumption:    Intune Client is included in the zip file and is called 

ECHO PLEASE DO NOT RESTART OR CLOSE YOUR MACHINE, IT WILL RESTART AUTOMATICALLY WHEN READY, WITHOUT WARNING
ECHO SAVE YOUR DOCUMENTS AND WORK BEFORE YOU PRESS "Enter"
Pause
 
:START
"C:\Program Files\Microsoft\OnlineManagement\Common\ProvisioningUtil.exe" /UninstallClient /ServiceId "{3DA21691-E39D-4DA6-8A4B-B43877BCB1B7}" /TaskName "tempTask" /SubEventId 16

:CHECK
REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OnlineManagement\{3DA21691-E39D-4DA6-8A4B-B43877BCB1B7}" > Null
IF %ERRORLEVEL%==1 GOTO REINSTALL
GOTO WAIT

:WAIT
timeout/t 30 > null
GOTO CHECK

:REINSTALL
timeout/t 15 > null
ECHO Old Management client removed, reinstalling and rebooting now...
%~dp0Microsoft_Intune_Setup.exe /Quiet
timeout/t 60 > null

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
0 Comment authors
Intune Client does not appear in console and displays error 0x80070005 when updating | Liebensraum Recent comment authors

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

  Subscribe  
newest oldest most voted
Notify of
trackback

[…] EDIT: if you want to ‘reset’ / ‘fix’ the Intune Client with a script / automatically, read here […]