Solved

Query Machines with SMS Client and Uninstall

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Online collaboration can help businesses be more efficient, help employees grow their skills and foster a team environment.
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

914 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

12 Experts available now in Live!

Get 1:1 Help Now