Posts

Reading the SCCM Client GUID

Recently I encountered an issue with the SCCM client GUID missing from the  %windir%\SMSCFG.INI file. We wanted to write a script to put the GUID back, so I was asked how to read the SCCM Client GUID from a script or command line. VBScript: Set objWMIService = GetObject("winmgmts:\\.\root\ccm") Set colItems = objWMIService.ExecQuery("Select ClientID From CCM_Client") For Each objItem in colItems Wscript.Echo "Client ID" & objItem.ClientID Next WMIC via commandline: wmic /namespace:\\root\ccm path ccm_client get clientid PowerShell: Get-WMIObject -namespace root\ccm ccm_client clientid | Select-Object clientid Suggested Reading: MSDN Article on How to Get the Unique Identifier Value for a Client (Includes Code Snippets) MSDN Article on Using the Get-WMiObject Cmdlet

How to Troubleshoot SMS Client Install Errors

Often time, I'm asked how to troubleshoot SMS client installation errors. First thing I would recommend is to check WMI by running wmidiag.vbs on the troubled computer, be sure to run it under admin context. The beauty of wmidiag is, it tells you how to fix the problem. Secondly, if WMI is fine, look through the installation or client logs.

SMS SQL for Last Hardware Inventory

The following SQL Query will return last HW Inventory date for a specific computer. Code is based on the client health queries by Paul Thomsen . -- Last hardware inventory select Name0, LastHWScan as 'HW Inventory' from v_R_System sys full join v_RA_System_SMSAssignedSites ass ON ass.resourceID=SYS.resourceID full join v_GS_WORKSTATION_STATUS WS ON WS.resourceID=sys.resourceID where client0=1 and Name0 = 'computername'

SMS SQL for Last Discovery

The following SQL Query will return last discovery date for a specific computer. Code is based on the client health queries by Paul Thomsen . -- Last discovery date select Name0, AgentTime as 'Discovery' from v_R_System sys full join v_RA_System_SMSAssignedSites ass ON ass.resourceID=SYS.resourceID full join (select ResourceId, MAX(AgentTime) as AgentTime from v_AgentDiscoveries where agentname<>'SMS Discovery Data Manager' AND agentname not like '%!_AD!_System%' ESCAPE'!' group by ResourceId) disc on disc.resourceid=sys.resourceid where client0=1 --and IsNULL(AgentTime,@NullVal)>@olddate and Name0 = 'computername'

VBScript to Set SMS Client Cache Location

Need to set the SMS Client Cache Location? Well it's pretty easy, here's a basic VBScript to help you get started. This will set the Advanced Clients Cache Location, just be careful to set it correctly. Test, Test, Test! I'd suggest an SMS Package with different cache locations passed via command line (in seperate programs) for maximum flexibility. ---- Begin VBScript ---- On Error Resume Next Dim oUIResourceMgr Dim oCache Set oUIResourceMgr = CreateObject("UIResource.UIResourceMgr") Set oCacheInfo = oUIResourceMgr.GetCacheInfo ' Set the new location, default is "C:\WINDOWS\system32\CCM\Cache" oCacheInfo.Location = "C:\WINDOWS\system32\CCM\Cache" 'Return the error so SMS can report it WScript.Quit(Err) ---- End VBScript ----

SMS SQL for Duplicate Collection Names

Recently, I've found many collections with duplicate names. The dupes can cause problems when managing those collections. I quickly created the following SQL to find the offending collections. -- This SQL query will show collections with duplicate names. Select parentCollectionID, ParentCollection.Name, v_Collection.CollectionID, v_Collection.Name from v_Collection left outer join v_CollectToSubCollect on v_Collection.collectionid=v_CollectToSubCollect.subcollectionid left outer join v_Collection ParentCollection on v_CollectToSubCollect.parentCollectionID = ParentCollection.collectionid where v_Collection.Name in (Select Name from v_Collection Group By Name Having Count(*)>1)

SMS 2003 Error 10035, What to Do

Error 10035, or Waiting for Content, seems to be one of the most frequent errors people encounter. Clients often generate this error even when they succeeed. When things go bad, it's important to understand how to troubleshoot error 10035, and know how to fix it. How to troubleshoot 10035 Waiting for Content Errors List of Status Message IDs