Solved

Query Machines with SMS Client and Uninstall

Posted on 2011-03-15
4
615 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
[X]
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
  • 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

Webinar: Choosing a MySQL HA Solution

Join Percona’s Principal Technical Services Engineer, Marcos Albe as he presents Choosing a MySQL High Availability Solution on Thursday, June 29, 2017 at 10:00 am PDT / 2:00 pm EDT (UTC-7).

Question has a verified solution.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
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…

726 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