Monday, November 16, 2015

Enable verbose logging for SCCM 2012



SCCM logging by default do not provide you with detailed information for you to do advanced analysis. To do so, you will need to enable Verbose / Debug or NAL. This logging will give you much more detailed information, and it will help you location the root of the problem.

Server verbose logging:

1 – open means

0 – off means

SCCM and components:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ SMS \ Tracing \ ENABLED = 1 – (REG_DWORD – General SCCM turn on Logging)

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ SMS \ Tracing \ xxxxxxx \ Enabled = 1 – (REG_DWORD – The Role SCCM’de If you change the compositions according to him)

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ SMS \ Tracing \ xxxxxxx \ MaxFileSize = 3000000 – (REG_DWORD – 3 MB large – NAL and Debug Logging for growth with more than it is worth)

Important components to be linked to SQL for SQL logging, open the key:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ SMS \ Tracing \ Sqlenabled = 1 – (REG_DWORD)

Component of SQL and SCCM logs, including:

ciamgr.log – SMS_CI_ASSIGNMENT_MANAGER

Colleval.log – SMS_COLLECTION_EVALUATOR

compsumm.log – SMS_COMPONENT_STATUS_SUMMARIZER

Dataldr.log – SMS_INVENTORY_DATA_LOADER

ddm.log – SMS_DISCOVERY_DATA_MANAGER

Distmgr.log – SMS_DISTRIBUTION_MANAGER

Hman.log – SMS_HIERARCHY_MANAGER

objreplmgr.log – SMS_OBJECT_REPLICATION_MANAGER

offermgr.log – SMS_OFFER_MANAGER

Offersum.log – SMS_OFFER_STATUS_SUMMARIZER

policypv.log – SMS_POLICY_PROVIDER

sinvproc.log – SMS_SOFTWARE_INVENTORY_PROCESSOR

Sitestat.log – SMS_SITE_SYSTEM_STATUS_SUMMARIZER

smsdbmon.log – SMS_DATABASE_NOTIFICATION_MONITOR

statesys.log – SMS_STATE_SYSTEM

Statmgr.log – SMS_STATUS_MANAGER

swmproc.log – SMS_SOFTWARE_METERING_PROCESSOR

wcm.log – SMS_WSUS_CONFIGURATION_MANAGER

wsyncmgr.log – SMS_WSUS_SYNC_MANAGER

SMS Provider

HKEY_LOCAL_MACHINE \ Software \ Microsoft \ SMS \ Providers \ Logging Level = 1 – (REG_DWORD)

HKEY_LOCAL_MACHINE \ Software \ Microsoft \ SMS \ Providers \ SQL Cache Logging Level = 1 – (REG_DWORD)

HKEY_LOCAL_MACHINE \ Software \ Microsoft \ SMS \ Providers \ Log Size MB = 1 – (REG_DWORD)

SCCM logumuz with logging provider are as follows:

Smsprov.log

NAL logging:

Sometimes it may be enough, and NAL logging verbose logging information in the pop-up. Caution: NAL logging Log file too big for him, keeping detailed logs have benefits.

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ NAL \ Logging

– DataType: REG_DWORD – Log To = 3

– DataType: REG_DWORD – Verbosity = 7

NAL logging, set the values:

NAL_LOG_VERBOSITY_LEVEL_1 = Errors

NAL_LOG_VERBOSITY_LEVEL_2 = Warnings

NAL_LOG_VERBOSITY_LEVEL_4 = Information

NAL_LOG_VERBOSITY_LEVEL_7 = Errors, Warnings, Information

SCCM loglarımız with NAL logging are as follows:

compsumm.log – SMS_COMPONENT_STATUS_SUMMARIZER

Distmgr.log – SMS_DISTRIBUTION_MANAGER

inboxmgr.log – SMS_INBOX_MANAGER

ntsvrdis.log – SMS_WINNT_SERVER_DISCOVERY_AGENT

sitecomp.log – SMS_SITE_COMPONENT_MANAGER

Sitestat.log – SMS_SITE_SYSTEM_STATUS_SUMMARIZER

smsexec.log – SMS_EXECUTIVE

IMPORTANT:Registry changes to work:

Stop the SMS_SITE_COMPONENT_MANAGER

Stop the SMS_EXECUTIVE

Start the SMS_EXECUTIVE

Start SMS_SITE_COMPONENT_MANAGER

SCCM Agent (Workstation):

CCM for the verbose logging:

For Administrator Key, “full rights” to provide the necessary – there is no default.

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ CCM \ Logging \ @ GLOBAL

Set of the following values:

LogEnabled = 1

LogLevel = 0

LogMaxSize = 40000000

LogDirectory = c: \ windows \ system32 \ ccm \ logs (If you want to print the logs to a different location)

LogMaxHistory = 1 (Although the size of the logs filled with incense,> here is one: will be holding an old log. Example: Execmgr.log and will execmgr.lo_.
Verbose logging is not enough DebugLogging CCM:

This is necessary to create the reg KEYI:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ CCM \ Logging \ DebugLogging

– DataType: REG_SZ – Enabled = TRUE

WMI:

SCCM agent is based entirely WMI WMI is useful to turn verbose logging:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WBEM \ CIMOM \ Logging = 0 – (REG_SZ – Disabled)

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WBEM \ CIMOM \ Logging = 1 – (REG_SZ – Error only)

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WBEM \ CIMOM \ Logging = 2 – (REG_SZ – Verbose)
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WBEM \ CIMOM \ Log File Max Size = 4000000 – (REG_DWORD – If you need to WMI 2)

IMPORTANT: To study the changes of registry and WMI:

Restart the Computer

Other important components are: WSUS + SCCM component:

Set HKLM \ SOFTWARE \ Microsoft \ SMS \ Components \ SMS_WSUS_SYNC_MANAGER

– DataType: REG_DWORD – LogLevel = 3
LOG_SUMMARY = 1;

LOG_DETAIL = 2; default

LOG_VERBOSE = 3;

LOG_DEBUG = 4;

Wednesday, October 21, 2015

SCCM Client Health State

Every SCCM Admin would have been asked this question, "Can you tell me which Client is not communicating back to the primary site server?"
All of us admin would know that a SCCM client is of no use if it does not communicate correctly back to the primary site server.
If it does not communicate, it will be be able to retrieve any machine policy.
If it does not communicate, it will be be able to send back the inventory information back to the Primary Site Server.
And of course the list goes on....

Using the query below, you will be able to do just that.
With the information that is made available, you will then be able to troubleshoot the client that are not working as expected.

SELECT [SMSID]
      ,[FQDN]
      ,[NetBiosName]
      ,[AssignedSiteCode]
      ,[HealthType]
      ,[HealthState]
      ,[HealthStateName]
      ,[ErrorCode]
      ,[ExtendedErrorCode]
      ,[LastHealthReportDate]
      ,substring(OU.System_OU_Name0,15,3) [Site]

  FROM [CM_C00].[dbo].[v_ClientHealthState] CHS
  left join v_R_System VRS on  VRS.Name0 = CHS.NetBiosName
  left join v_RA_System_SystemOUName OU on ou.ResourceID = VRS.ResourceID

order by HealthState desc


Friday, October 2, 2015

Capturing Windows Activation Key by SCCM

Most of the enterprise that are using Windows as the Operating System would most likely be using Microsoft Multiple Activation Keys or MAk for short for licensing.
There maybe a day which come when you may need to figure out how to get the number of clients in your environment that are activated using a particular product key. (This will NOT work for MAK but if needed, you can still use the generated product ID to tied to a valid ID)
This information unfortunately is not readily available in SCCM and would require some work to have it available.

The VBS that has been written below enables you to be able to retrieve the MAK and store it in a registry key (in the script, I have stored it on HKLM\Software\SCCM\ActivationKey).
Once you have this value available, you will be able to by means of SCCM to do a hardware inventory to retrieve the information and format it accordingly for use.
Hopefully this helps anyone who requires this.

Option Explicit 

Const HKEY_LOCAL_MACHINE = &H80000002
Dim objshell,path,DigitalID, Result ,Strcomputer,objregistry,strkeypath,strvaluename,strvalue,strvaluename1
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId4")
Dim ProductName,ProductID,ProductKey,ProductData
'Get ProductName, ProductID, ProductKey
ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID")
ProductKey = ConvertToKey(DigitalID) 
ProductData = ProductName  & vbNewLine & ProductID  & vbNewLine & ProductKey
'wscript.echo ProductData

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & _ 
    strComputer & "\root\default:StdRegProv")

'Check for the existance of the key and create if it's not found.
strKeyPath = "SOFTWARE\SCCM\"
strValueName = "ActivationKey"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

If IsNull(strValue) Then

objregistry.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
StrValueName1 = "ActivationKey"

objRegistry.SetStringValue HKEY_Local_Machine, strKeyPath, strValueName1,ProductKey

End If

'Convert binary to chars
Function ConvertToKey(Key)
    Const KeyOffset = 52
    Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
    'Check if OS is Windows 8
    isWin8 = (Key(66) \ 6) And 1
    Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
    i = 24
    Maps = "BCDFGHJKMPQRTVWXY2346789"
    Do
        Current= 0
        j = 14
        Do
           Current = Current* 256
           Current = Key(j + KeyOffset) + Current
           Key(j + KeyOffset) = (Current \ 24)
           Current=Current Mod 24
            j = j -1
        Loop While j >= 0
        i = i -1
        KeyOutput = Mid(Maps,Current+ 1, 1) & KeyOutput
        Last = Current
    Loop While i >= 0 
    keypart1 = Mid(KeyOutput, 2, Last)
    insert = "N"
    KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
    If Last = 0 Then KeyOutput = insert & KeyOutput
    ConvertToKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5)
   
    
End Function