Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Query Machines with SMS Client and Uninstall

Posted on 2011-03-15
4
612 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Both MMF (multi-mode fiber) and SMF (single-mode fiber) are types of optical fiber that can aid in communication applications. These thin strands of silica or glass will allow communication to occur between devices. The transmission of light between…
Not many admins are aware that GPOs can be activated and deactivated time-based. Time to change that :)
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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