Thursday, 24 June 2010

Duplicate PC's or GUIDS in my SCCM

THANKS TO James C Avery for this one!!!! SAVED ME A LOT OF TROUBLE

Have you ran across where you keep seeing PC's show up in your Collections with duplicate names and every time you update and refresh the collection you'll see a different set of PC's show duplicates.

I was seeing this happen while at a customer and it turned out they imaged a machine with ghost and then used that image over and over and over. Well, if they don't prep that machine correctly with sysprep and the have the SCCM or SMS client already installed, this will cause a problem that you could be tracking down for days.


To resolve this issue, let's see how many duplicates you have. Create a collection and add the following 3 queries as part of the collection. Then update and refresh your collection.

Query 1
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System where ClientVersion = "2.50.4160.2000" or Client is NULL


Query 2
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System join SMS_G_System_System on SMS_R_System.ResourceID = SMS_G_System_System.ResourceID where SMS_R_System.Name <> SMS_G_System_System.Name



Query 3select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client from SMS_R_System where SMS_R_System.ResourceID in (select SMS_GH_System_System.ResourceID from SMS_G_System_System join SMS_GH_System_System on SMS_G_System_System.ResourceID = SMS_GH_System_System.ResourceID where SMS_G_System_System.Name <> SMS_GH_System_System.Name)

Now you should have a list of machines showing duplicate GUIDS in your database. Just FYI, this isn't always the most accurate, but this allows you a starting place to attach the problem.

Next let's start attacking the problem, you know everyone has to start somewhere.


Create some scripts to fix this issue.


Create a directory called "FixMyGuids"
In that directory download the PSTOOLS from Microsoft. http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

Download the Sleep.exe

Download the SMS 2003 Toolkit 2 http://technet.microsoft.com/en-us/sms/bb676787.aspx

Now create these batch files:
"CallFinalProcess.bat" Call FinalProcess.bat Call FinalProcess.bat Call FinalProcess.bat Etc….

"FinalProcess.bat" echo starting the FixMyGuid batch file 1copy /Y D:\DATA\Package$\FixMyGUID\fixmyguid.bat file://%251/c$./PSTools/psexec -accepteula file://%251/ -u deops\ -p /s c:\fixmyguid.bat
"FixMyGuid.bat" @echo off echo starting the FixMyGuid batch file 2 echo copy sleep.exe file copy /Y \\\package$\FixMyGUID\sleep.exe %windir% sleep 10 /quiet echo copy tranguid.exe file copy /Y \\\package$\FixMyGUID\tranguid.exe %windir% rem sleep 10 /quiet echo copy CCMDelCert.exe file copy /Y \\\package$\FixMyGUID\CCMDelCert.exe %windir% sleep 10 /quiet echo running CCMDelCert to repair GUID %windir%\CCMDelCert.exe sleep 10 /quiet net stop ccmexec net start ccmexec rem rem @echo rebooting workstation in 20 seconds rem \\ name>\package$\FixMyGUID\Pstools\PSSHUTDOWN -r -f \\ name>


Now you have the Duplicate GUIDS collection created. Downloaded the files required to reset the GUIDS in the SMSCFG.INI file and created the scripts to download certain files and run exe's on the workstation to resolve the issue.



What I would have liked to add is the last scripts a command to restart the workstation. If your calling the script and you know that no one is on that pc, you can remove the REM commands at the end. We're nearing the end of the process, we need do the following to prepare for deployment.


Go to SCCM Reports and run report #130 from the Duplicate GUIDS collection. Export the list to a CSV file and clean the file up. Then add "Call FinalProcess.bat" before the computer name as shown in #2. Copy and Paste the list to the CallFinalProcess.bat file Open a CMD Prompt and run CallFinalProcess.bat file form the server.

On average you'll have to give the machines at least 5 minutes to update before you'll see the difference on SCCM. Nothing will hurt if you would like to update and refresh the Duplicate GUID collection.

Also, you may have to run the process several times throughout a week or more since some laptops will be disconnected or not turned on.

No comments:

Post a Comment