Solved

Query Machines with SMS Client and Uninstall

Posted on 2011-03-15
4
605 Views
Last Modified: 2012-05-11
What is best way to query machines that have SMS clients running on them and uninstalling them remotely? Any info would be much appreciated. Thank you for the help.
0
Comment
Question by:mmoya
  • 3
4 Comments
 
LVL 9

Expert Comment

by:Scottyworld
ID: 35143767
Do you want to do this without using SMS itself? Otherwise you could just query the collection - Default - All Windows XP Systems with a client status of Yes
Then advertise the uninstall program to all of them !

Or
Run a script that would first check the registry key
HKLM\SOFTWARE\Microsoft\SMS\Mobile Client\Product Version
If it is populated, then you can assume SMS is installed.
Then run the uninstall program if this key is found

This could be configured via a GPO PC startup script if required.

Or:
Check if the service SMS Agent Host is running on the client before running the uninstall program

We had to do this a while ago, so if you need the remove script, please let me know
0
 

Author Comment

by:mmoya
ID: 35147063
Thank you for the info. Yes, I want to do it without SMS itself.  Yes, I'd like to see the remove script as well. Thank you again.
0
 
LVL 9

Accepted Solution

by:
Scottyworld earned 500 total points
ID: 35151803
The attached code will check the registry to see if SMS has been installed. Just change the regdata value(line 4) to match whatever site code you used.
Line 8 - you will need to provide the path to the ccmclean.exe file (in the SMS2003 toolkit)
It will also tidy up any remaining reg entries and the CCM folders in the windows directory.

We pushed this out via GPO startup script.
@ECHO OFF
set regpath=HKLM\SOFTWARE\Microsoft\SMS\Mobile Client
set regvalue=AssignedSiteCode
set regdata=SMS
reg query "%regpath%" /v "%regvalue%" | find /i "%regdata%"
if errorlevel 0 (
	REM Run CCMCLEAN to remove SMS Adv Client
	%LOGONSERVER%\netlogon\sms2003\ccmclean.exe /all

	REM Delete CCM folder on C:\
	RMDIR /S /Q %SYSTEMROOT%\system32\CCM

	REM Delete CCMSETUP folder on C:\
	RMDIR /S /Q %SYSTEMROOT%\system32\ccmsetup

	REM Deletes SMS register folder 
	REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS /f
)

Open in new window

0
 
LVL 9

Expert Comment

by:Scottyworld
ID: 35151835
You could also do it by checking if the SMS service is running on the PC (ccmexec)
Just replace the top of the last script with this.
This queries the service ccmexec (which is the SMS Agent Host) and if it has a status of running, will execute the removal script. We chose not to use this method though as some PCs had SMS installed, but the service had stopped for some reason.
 
@echo off
sc query ccmexec | findstr "RUNNING"
If errorlevel 0 (

Open in new window

0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

This is a based on my experience in IT role and also my role before that, a builder. These 1st contact rules have helped me and more importantly help past, present and hopefully future client/people I get to work/assist. Via Telephone: 1.      Answ…
Ever wondered why Windows 8 and 10 don't seem to accept your GPO-based software deployment while Windows 7 does? Read on.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now