Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Query Machines with SMS Client and Uninstall

Posted on 2011-03-15
4
Medium Priority
?
619 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 2000 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

WatchGuard Case Study: Museum of Flight

“With limited money and limited staffing, we didn’t have a lot of choices in terms of what we could do to bring efficiency. WatchGuard played a central part in changing that.” To provide strong, secure Wi-Fi access within the museum, Hunter chose to deploy WatchGuard’s AP120 APs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introducing Priority Question, our latest feature.
Article by: Shawn
IT teams define success as solving problems quickly. To enable ITSM modernization we have to think of adopting the tools and methods that will enable resolution of ITSM issues more quickly.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

971 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